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
c4031c2b
Commit
c4031c2b
authored
Feb 08, 2016
by
Maciej Lipinski
Committed by
Adam Wujek
Feb 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/tools: add option to pstats to dump counters from switch startup
-s option for that
parent
6946ca99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
wrs_pstats.c
userspace/tools/wrs_pstats.c
+11
-5
No files found.
userspace/tools/wrs_pstats.c
View file @
c4031c2b
...
...
@@ -74,7 +74,7 @@ char info[][20] = {{"Tu-run|"}, // 0
{
"TRUrsp|"
}
// 38
};
int
pstats_init
(
void
)
int
pstats_init
(
int
init
)
{
int
err
,
i
,
j
;
...
...
@@ -92,7 +92,7 @@ int pstats_init(void)
cnt_pp
[
i
][
j
].
init
=
0
;
cnt_pp
[
i
][
j
].
cnt
=
0
;
}
parse_sysfs
(
1
);
parse_sysfs
(
init
);
return
0
;
}
...
...
@@ -102,7 +102,7 @@ static void parse_sysfs(int init)
uint32_t
port
,
cntr
,
val
;
char
filename
[
30
];
if
(
init
)
{
if
(
init
==
1
)
{
for
(
port
=
0
;
port
<
use_ports
;
++
port
)
{
sprintf
(
filename
,
"/proc/sys/pstats/port%u"
,
port
);
file
=
fopen
(
filename
,
"r"
);
...
...
@@ -183,6 +183,7 @@ void print_info(char *prgname)
" -a Show all counters (don't fit screen)
\n
"
" -t Show traffic only, i.e. rx/tx-ed frames
\n
"
" -n Define 8/18 ports version
\n
"
" -s Show counter values from start of device
\n
"
" -h Show this message
\n
"
);
}
...
...
@@ -195,9 +196,10 @@ int main(int argc, char **argv)
int
ep_cnts
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
};
//29
int
traffic
[]
=
{
18
,
19
};
//2
int
op
=
0
,
c
;
int
init
=
1
;
use_ports
=
NPORTS
;
while
(
(
c
=
getopt
(
argc
,
argv
,
"ph
ertan:"
))
!=
-
1
)
{
while
(
(
c
=
getopt
(
argc
,
argv
,
"phs
ertan:"
))
!=
-
1
)
{
switch
(
c
)
{
case
'n'
:
use_ports
=
atoi
(
optarg
);
...
...
@@ -209,6 +211,9 @@ int main(int argc, char **argv)
case
't'
:
op
=
c
;
break
;
case
's'
:
init
=
2
;
break
;
case
'h'
:
default:
print_info
(
argv
[
0
]);
...
...
@@ -216,7 +221,8 @@ int main(int argc, char **argv)
}
}
if
(
pstats_init
())
return
-
1
;
if
(
pstats_init
(
init
))
return
-
1
;
while
(
1
)
{
...
...
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