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
71937f26
Commit
71937f26
authored
May 21, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fd-raw-input: added FD_SHOW_TIME environment var
parent
a7036a27
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
fd-raw-input.c
tools/fd-raw-input.c
+25
-3
No files found.
tools/fd-raw-input.c
View file @
71937f26
...
...
@@ -17,6 +17,8 @@
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <time.h>
#include <sys/time.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/stat.h>
...
...
@@ -28,6 +30,7 @@
enum
{
MODE_HEX
,
MODE_FLOAT
,
MODE_PICO
};
int
expect
;
int
show_time
;
void
event
(
uint32_t
*
a
,
char
*
name
,
int
*
seq
,
int
mode
,
long
double
*
t1
,
uint64_t
*
p1
)
...
...
@@ -47,7 +50,24 @@ void event(uint32_t *a, char *name, int *seq, int mode, long double *t1,
}
*
seq
=
sequence
;
printf
(
"%s: "
,
name
);
if
(
show_time
)
{
static
struct
timeval
tv
,
otv
;
int
deltamicro
;
gettimeofday
(
&
tv
,
NULL
);
if
(
otv
.
tv_sec
)
{
deltamicro
=
(
tv
.
tv_sec
-
otv
.
tv_sec
)
*
1000
*
1000
+
tv
.
tv_usec
-
otv
.
tv_usec
;
printf
(
"+ %i.%06i: "
,
deltamicro
/
1000
/
1000
,
deltamicro
%
(
1000
*
1000
));
}
else
{
printf
(
"%03i.%06i: "
,
tv
.
tv_sec
%
1000
,
tv
.
tv_usec
);
}
otv
=
tv
;
}
else
{
/* time works with one file only, avoid the fname */
printf
(
"%s: "
,
name
);
}
switch
(
mode
)
{
case
MODE_HEX
:
printf
(
"%08x %08x %08x %08x %08x
\n
"
,
...
...
@@ -110,8 +130,10 @@ int main(int argc, char **argv)
uint64_t
p1
[
MAXFD
]
=
{
0LL
,};
uint32_t
*
attrs
;
if
(
getenv
(
"EXPECTED_RATE"
))
expect
=
atoi
(
getenv
(
"EXPECTED_RATE"
));
if
(
getenv
(
"FD_EXPECTED_RATE"
))
expect
=
atoi
(
getenv
(
"FD_EXPECTED_RATE"
));
if
(
getenv
(
"FD_SHOW_TIME"
))
show_time
=
1
;
if
(
argc
>
1
&&
!
strcmp
(
argv
[
1
],
"-f"
))
{
mode
=
MODE_FLOAT
;
...
...
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