Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
White Rabbit Switch - Software
Commits
2da6c927
Commit
2da6c927
authored
Feb 17, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/tools: support 64 bit pstats counters
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
69103e6e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
wrs_pstats.c
userspace/tools/wrs_pstats.c
+15
-7
No files found.
userspace/tools/wrs_pstats.c
View file @
2da6c927
...
...
@@ -5,6 +5,7 @@
// #include<regs/dummy-regs.h>
#include<time.h>
#include<poll.h>
#include <inttypes.h>
/*temp*/
#include <stddef.h>
...
...
@@ -26,8 +27,8 @@ static void parse_sysfs(int init);
#define CNT_PP 39
struct
cnt_word
{
uint
32_t
cnt
;
//4 cntrs per 32-bit word
uint
32
_t
init
;
uint
64_t
cnt
;
uint
64
_t
init
;
};
struct
cnt_word
cnt_pp
[
NPORTS
][
CNT_PP
];
...
...
@@ -99,7 +100,10 @@ int pstats_init(int init)
static
void
parse_sysfs
(
int
init
)
{
FILE
*
file
;
uint32_t
port
,
cntr
,
val
;
uint32_t
port
,
cntr
;
uint32_t
tmp1
;
uint32_t
tmp2
;
uint64_t
val
;
char
filename
[
30
];
if
(
init
==
1
)
{
...
...
@@ -107,7 +111,9 @@ static void parse_sysfs(int init)
sprintf
(
filename
,
"/proc/sys/pstats/port%u"
,
port
);
file
=
fopen
(
filename
,
"r"
);
for
(
cntr
=
0
;
cntr
<
CNT_PP
;
++
cntr
)
{
fscanf
(
file
,
"%u
\t
"
,
&
val
);
fscanf
(
file
,
"%"
SCNu32
,
&
tmp1
);
fscanf
(
file
,
"%"
SCNu32
,
&
tmp2
);
val
=
(((
uint64_t
)
tmp2
)
<<
32
)
|
tmp1
;
cnt_pp
[
port
][
cntr
].
init
=
val
;
}
fclose
(
file
);
...
...
@@ -119,7 +125,9 @@ static void parse_sysfs(int init)
sprintf
(
filename
,
"/proc/sys/pstats/port%u"
,
port
);
file
=
fopen
(
filename
,
"r"
);
for
(
cntr
=
0
;
cntr
<
CNT_PP
;
++
cntr
)
{
fscanf
(
file
,
"%u
\t
"
,
&
val
);
fscanf
(
file
,
"%"
SCNu32
,
&
tmp1
);
fscanf
(
file
,
"%"
SCNu32
,
&
tmp2
);
val
=
(((
uint64_t
)
tmp2
)
<<
32
)
|
tmp1
;
cnt_pp
[
port
][
cntr
].
cnt
=
val
-
cnt_pp
[
port
][
cntr
].
init
;
}
fclose
(
file
);
...
...
@@ -145,7 +153,7 @@ void print_first_n_cnts(int n_cnts)
{
printf
(
"%2u|"
,
port
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%9u|"
,
cnt_pp
[
port
][
cnt
].
cnt
);
printf
(
"%9
ll
u|"
,
cnt_pp
[
port
][
cnt
].
cnt
);
printf
(
"
\n
"
);
}
}
...
...
@@ -167,7 +175,7 @@ void print_chosen_cnts( int cnts_list[], int n_cnts)
{
printf
(
"%2u|"
,
port
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%9u|"
,
cnt_pp
[
port
][
cnts_list
[
cnt
]].
cnt
);
printf
(
"%9
ll
u|"
,
cnt_pp
[
port
][
cnts_list
[
cnt
]].
cnt
);
printf
(
"
\n
"
);
}
}
...
...
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