Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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 - Software
Commits
5a3a6f17
Commit
5a3a6f17
authored
May 05, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/fd-raw-perf.c: added env(PERF_STEP)
parent
997a9198
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
fd-raw-perf.c
tools/fd-raw-perf.c
+17
-3
No files found.
tools/fd-raw-perf.c
View file @
5a3a6f17
...
...
@@ -34,6 +34,7 @@
struct
fd_perf
{
/* sequence is 16-bits, do the same here */
uint16_t
first
,
prev
;
/* sequence numbers: -1 == "not in a burst" */
struct
timeval
tv
;
uint
nev
;
uint64_t
pico_tot
,
micro_tot
;
int64_t
pico_prev
,
pico_min
,
pico_max
,
pico_avg
;
...
...
@@ -51,13 +52,12 @@ static void perf_clean(struct fd_perf *p)
static
void
perf_one
(
struct
fd_perf
*
p
,
uint32_t
*
a
/* attrs */
)
{
struct
timeval
tv
;
int64_t
pico
,
micro
,
diff
;
gettimeofday
(
&
tv
,
NULL
);
gettimeofday
(
&
p
->
tv
,
NULL
);
pico
=
a
[
FD_ATTR_TDC_COARSE
]
*
8000LL
+
(
a
[
FD_ATTR_TDC_FRAC
]
<<
12
)
/
8000
;
micro
=
tv
.
tv_usec
;
micro
=
p
->
tv
.
tv_usec
;
if
(
!
p
->
nev
)
{
p
->
first
=
a
[
FD_ATTR_TDC_SEQ
];
...
...
@@ -130,6 +130,10 @@ int main(int argc, char **argv)
struct
fd_perf
perf
=
{
0
,};
int
floatmode
=
0
;
uint32_t
*
attrs
;
int
step
=
0
;
if
(
getenv
(
"PERF_STEP"
))
step
=
atoi
(
getenv
(
"PERF_STEP"
));
if
(
argc
>
1
&&
!
strcmp
(
argv
[
1
],
"-f"
))
{
floatmode
=
1
;
...
...
@@ -209,6 +213,16 @@ int main(int argc, char **argv)
attrs
=
ctrl
.
attr_channel
.
ext_val
;
perf_one
(
&
perf
,
attrs
);
}
if
(
step
&&
perf
.
nev
)
{
static
time_t
t
;
/* don't make an extra system call, use perf.tv */
if
(
perf
.
nev
==
1
)
t
=
perf
.
tv
.
tv_sec
;
else
if
(
perf
.
tv
.
tv_sec
-
t
>=
step
)
perf_report_clean
(
&
perf
);
}
}
return
0
;
}
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