Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr-switch-sw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
wr-switch-sw
Commits
2a9c9105
Commit
2a9c9105
authored
Feb 08, 2016
by
Maciej Lipinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/tools: add option to pstats to dump counters from switch startup
parent
3eb6e4e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
wrs_pstats.c
userspace/tools/wrs_pstats.c
+10
-5
No files found.
userspace/tools/wrs_pstats.c
View file @
2a9c9105
...
@@ -74,7 +74,7 @@ char info[][20] = {{"Tu-run|"}, // 0
...
@@ -74,7 +74,7 @@ char info[][20] = {{"Tu-run|"}, // 0
{
"TRUrsp|"
}
// 38
{
"TRUrsp|"
}
// 38
};
};
int
pstats_init
(
void
)
int
pstats_init
(
int
init
)
{
{
int
err
,
i
,
j
;
int
err
,
i
,
j
;
...
@@ -92,7 +92,7 @@ int pstats_init(void)
...
@@ -92,7 +92,7 @@ int pstats_init(void)
cnt_pp
[
i
][
j
].
init
=
0
;
cnt_pp
[
i
][
j
].
init
=
0
;
cnt_pp
[
i
][
j
].
cnt
=
0
;
cnt_pp
[
i
][
j
].
cnt
=
0
;
}
}
parse_sysfs
(
1
);
parse_sysfs
(
init
);
return
0
;
return
0
;
}
}
...
@@ -102,7 +102,7 @@ static void parse_sysfs(int init)
...
@@ -102,7 +102,7 @@ static void parse_sysfs(int init)
uint32_t
port
,
cntr
,
val
;
uint32_t
port
,
cntr
,
val
;
char
filename
[
30
];
char
filename
[
30
];
if
(
init
)
{
if
(
init
==
1
)
{
for
(
port
=
0
;
port
<
use_ports
;
++
port
)
{
for
(
port
=
0
;
port
<
use_ports
;
++
port
)
{
sprintf
(
filename
,
"/proc/sys/pstats/port%u"
,
port
);
sprintf
(
filename
,
"/proc/sys/pstats/port%u"
,
port
);
file
=
fopen
(
filename
,
"r"
);
file
=
fopen
(
filename
,
"r"
);
...
@@ -183,6 +183,7 @@ void print_info(char *prgname)
...
@@ -183,6 +183,7 @@ void print_info(char *prgname)
" -a Show all counters (don't fit screen)
\n
"
" -a Show all counters (don't fit screen)
\n
"
" -t Show traffic only, i.e. rx/tx-ed frames
\n
"
" -t Show traffic only, i.e. rx/tx-ed frames
\n
"
" -n Define 8/18 ports version
\n
"
" -n Define 8/18 ports version
\n
"
" -v Show counter values from start of device
\n
"
" -h Show this message
\n
"
);
" -h Show this message
\n
"
);
}
}
...
@@ -195,9 +196,10 @@ int main(int argc, char **argv)
...
@@ -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
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
traffic
[]
=
{
18
,
19
};
//2
int
op
=
0
,
c
;
int
op
=
0
,
c
;
int
init
=
1
;
use_ports
=
NPORTS
;
use_ports
=
NPORTS
;
while
(
(
c
=
getopt
(
argc
,
argv
,
"phertan:"
))
!=
-
1
)
{
while
(
(
c
=
getopt
(
argc
,
argv
,
"ph
v
ertan:"
))
!=
-
1
)
{
switch
(
c
)
{
switch
(
c
)
{
case
'n'
:
case
'n'
:
use_ports
=
atoi
(
optarg
);
use_ports
=
atoi
(
optarg
);
...
@@ -209,6 +211,9 @@ int main(int argc, char **argv)
...
@@ -209,6 +211,9 @@ int main(int argc, char **argv)
case
't'
:
case
't'
:
op
=
c
;
op
=
c
;
break
;
break
;
case
'v'
:
init
=
2
;
break
;
case
'h'
:
case
'h'
:
default:
default:
print_info
(
argv
[
0
]);
print_info
(
argv
[
0
]);
...
@@ -216,7 +221,7 @@ int main(int argc, char **argv)
...
@@ -216,7 +221,7 @@ int main(int argc, char **argv)
}
}
}
}
if
(
pstats_init
())
return
-
1
;
if
(
pstats_init
(
init
))
return
-
1
;
while
(
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