Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha
Commits
dd1fcc01
Commit
dd1fcc01
authored
Jan 25, 2013
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: added timeout in fd-raw-input
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
f7758352
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
fine-delay.in
doc/fine-delay.in
+5
-0
fd-raw-input.c
tools/fd-raw-input.c
+17
-6
No files found.
doc/fine-delay.in
View file @
dd1fcc01
...
...
@@ -1061,6 +1061,11 @@ is only printed once, and later lines begin with a single blank space
(
you
may
see
more
blanks
because
they
are
part
of
normal
output
,
for
alignment
purposes
).
If
you
are
using
the
tool
in
a
script
,
and
you
want
to
capture
all
the
samples
in
a
burst
and
then
terminate
,
you
can
specify
a
timeout
,
in
microseconds
,
using
@
t
{-
t
}.
The
timeout
is
only
applied
after
the
first
pulse
is
received
.
Finally
,
the
program
uses
two
environment
variables
,
if
set
to
any
value
:
@
code
{
FD_SHOW_TIME
}
make
the
tool
report
the
time
difference
between
sequential
reads
,
which
is
mainly
useful
to
debug
the
driver
workings
;
...
...
tools/fd-raw-input.c
View file @
dd1fcc01
...
...
@@ -122,8 +122,9 @@ struct zio_control ctrl;
int
main
(
int
argc
,
char
**
argv
)
{
glob_t
glob_buf
;
int
i
,
j
,
maxfd
=
0
;
int
i
,
j
,
tout
=
0
,
maxfd
=
0
;
int
fd
[
MAXFD
],
seq
[
MAXFD
];
struct
timeval
tv
,
*
tvp
=
NULL
;
fd_set
allset
,
curset
;
int
modemask
=
MODE_HEX
;
long
double
t1
[
MAXFD
]
=
{
0
.
0
,};
...
...
@@ -135,7 +136,7 @@ int main(int argc, char **argv)
if
(
getenv
(
"FD_SHOW_TIME"
))
show_time
=
1
;
while
((
i
=
getopt
(
argc
,
argv
,
"fprh"
))
!=
-
1
)
{
while
((
i
=
getopt
(
argc
,
argv
,
"fprh
t:
"
))
!=
-
1
)
{
switch
(
i
)
{
case
'f'
:
...
...
@@ -150,6 +151,9 @@ int main(int argc, char **argv)
case
'h'
:
modemask
|=
MODE_HEX
;
break
;
case
't'
:
tout
=
atoi
(
optarg
);
break
;
}
}
/* adjust for consumed arguments */
...
...
@@ -196,11 +200,13 @@ int main(int argc, char **argv)
seq
[
i
]
=
-
1
;
}
if
(
tout
==
0
)
setlinebuf
(
stdout
);
tvp
=
NULL
;
/* Ok, now wait for each of them to spit a timestamp */
setlinebuf
(
stdout
);
while
(
1
)
{
curset
=
allset
;
switch
(
select
(
maxfd
+
1
,
&
curset
,
NULL
,
NULL
,
NULL
))
{
switch
(
select
(
maxfd
+
1
,
&
curset
,
NULL
,
NULL
,
tvp
))
{
case
-
1
:
if
(
errno
==
EINTR
)
continue
;
...
...
@@ -208,9 +214,14 @@ int main(int argc, char **argv)
strerror
(
errno
));
exit
(
1
);
case
0
:
continue
;
exit
(
0
);
}
if
(
tout
)
{
/* prepare timeout for next time */
tv
.
tv_sec
=
tout
/
(
1000
*
1000
);
tv
.
tv_usec
=
tout
%
(
1000
*
1000
);
tvp
=
&
tv
;
}
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
!
FD_ISSET
(
fd
[
i
],
&
curset
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment