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
720df3c8
Commit
720df3c8
authored
Jul 20, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch "greg-nicstats"
adding support for NIC TX Frames counter and update SNMP due to that
parents
8fa85648
7723f724
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
158 additions
and
124 deletions
+158
-124
wr_pstats.c
kernel/wr_pstats/wr_pstats.c
+11
-7
wr_pstats.h
kernel/wr_pstats/wr_pstats.h
+1
-1
WR-SWITCH-MIB.txt
userspace/snmpd/WR-SWITCH-MIB.txt
+11
-2
wrsNetworkingStatusGroup.c
userspace/snmpd/wrsNetworkingStatusGroup.c
+26
-13
wrsNetworkingStatusGroup.h
userspace/snmpd/wrsNetworkingStatusGroup.h
+4
-0
wrsPstatsHCTable.c
userspace/snmpd/wrsPstatsHCTable.c
+3
-0
wrsPstatsHCTable.h
userspace/snmpd/wrsPstatsHCTable.h
+2
-1
wrs_pstats.c
userspace/tools/wrs_pstats.c
+100
-100
No files found.
kernel/wr_pstats/wr_pstats.c
View file @
720df3c8
...
...
@@ -100,7 +100,8 @@ static struct pstats_version_description pstats_desc[] = {
"FastMatch: Resp Valid
\n
"
/* 35 */
"FullMatch: Resp Valid
\n
"
/* 36 */
"Forwarded
\n
"
/* 37 */
"TRU Resp Valid"
,
/* 38 */
"TRU Resp Valid
\n
"
/* 38 */
"NIC TX Frames"
,
/* 39 */
.
rx_packets
=
19
,
/* RX Frames */
.
tx_packets
=
18
,
/* TX Frames */
.
rx_errors
=
6
,
/* RX PCS Errors */
...
...
@@ -225,11 +226,13 @@ static void pstats_tlet_fn(unsigned long arg)
*/
spin_lock
(
&
device
->
port_mutex
[
port
]);
cntrs_ov
=
&
(
device
->
overflows
[
device
->
irqs_tail
][
port
]);
//if(port==0)
// printk(KERN_WARNING "cntrs_ov: %08x %08x\n", (uint32_t)((*cntrs_ov)>>32 & 0xffffffff),
// (uint32_t)((*cntrs_ov) & 0x00ffffffffLL));
/* if(port==0)
* printk(KERN_WARNING "cntrs_ov: %08x %08x\n", (uint32_t)((*cntrs_ov)>>32 & 0xffffffff),
* (uint32_t)((*cntrs_ov) & 0x00ffffffffLL));
*/
for
(
cntr
=
0
;
cntr
<
firmware_counters
;
++
cntr
)
{
/*decode counters overflow flags to increment coutners*/
/* decode counters overflow flags to increment
* coutners */
if
((
*
cntrs_ov
)
>>
cntr
&
0x01
)
{
ptr
=
&
(
device
->
cntrs
[
port
][
cntr
]);
*
ptr
+=
1
<<
PSTATS_MSB_SHIFT
;
...
...
@@ -258,7 +261,7 @@ static irqreturn_t pstats_irq_handler(int irq, void *devid)
device
->
overflows
[
device
->
irqs_head
][
i
]
=
pstats_irq_cntrs
(
i
);
device
->
irqs_head
=
(
device
->
irqs_head
+
1
)
%
PSTATS_IRQBUFSZ
;
/
/device->port_irqs[device->irqs_head++ % PSTATS_IRQBUFSZ] = irqs;
/
* device->port_irqs[device->irqs_head++ % PSTATS_IRQBUFSZ] = irqs; */
tasklet_schedule
(
&
proc_ports
);
pstats_irq_enable
(
portmsk
);
...
...
@@ -385,7 +388,8 @@ static int pstats_handler(ctl_table *ctl, int write, void *buffer,
return
ret
;
}
/* one per port, then info and description, and terminator, filled at init time */
/* one per port, then info and description, and terminator,
* filled at init time */
static
ctl_table
pstats_ctl_table
[
PSTATS_MAX_NPORTS
+
3
];
static
ctl_table
proc_table
[]
=
{
...
...
kernel/wr_pstats/wr_pstats.h
View file @
720df3c8
...
...
@@ -7,7 +7,7 @@
#define WRVIC_BASE_IRQ (NR_AIC_IRQS + (5 * 32))
/*****/
#define PSTATS_MAX_NUM_OF_COUNTERS
39
/* Maximum number of counters
#define PSTATS_MAX_NUM_OF_COUNTERS
40
/* Maximum number of counters
* supported by the driver */
#define PSTATS_MAX_NPORTS 18
/* Maximum number of ports
...
...
userspace/snmpd/WR-SWITCH-MIB.txt
View file @
720df3c8
...
...
@@ -2036,7 +2036,8 @@ WrsPstatsHCEntry ::=
wrsPstatsHCFastMatchRespValid Counter64,
wrsPstatsHCFullMatchRespValid Counter64,
wrsPstatsHCForwarded Counter64,
wrsPstatsHCTRURespValid Counter64
wrsPstatsHCTRURespValid Counter64,
wrsPstatsHCNICTXFrames Counter64
}
wrsPstatsHCIndex OBJECT-TYPE
...
...
@@ -2376,7 +2377,15 @@ wrsPstatsHCTRURespValid OBJECT-TYPE
DESCRIPTION
"Number of TRU decisions"
::= { wrsPstatsHCEntry 41 }
wrsPstatsHCNICTXFrames OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of TX frames coming from CPU"
::= { wrsPstatsHCEntry 42 }
--wrsNetworking
--Configuration
END
\ No newline at end of file
END
userspace/snmpd/wrsNetworkingStatusGroup.c
View file @
720df3c8
...
...
@@ -48,6 +48,10 @@ static void copy_pstats(struct ns_pstats *copy, struct wrsPstatsHCTable_s *org,
/* wrsRTUStatus */
copy
->
wrsPstatsHCRXDropRTUFull
=
org
->
wrsPstatsHCRXDropRTUFull
;
copy
->
wrsPstatsHCTXFrames
=
org
->
wrsPstatsHCTXFrames
;
copy
->
wrsPstatsHCForwarded
=
org
->
wrsPstatsHCForwarded
;
copy
->
wrsPstatsHCNICTXFrames
=
org
->
wrsPstatsHCNICTXFrames
;
copy
++
;
org
++
;
}
...
...
@@ -86,11 +90,11 @@ static int get_swcore_status(struct ns_pstats *old,
float
t_delta
)
{
int
i
;
int
ret
;
ret
=
0
;
/* don't use this function for now, return OK */
return
ret
;
int
ret
=
0
;
uint64_t
total_fwd_delta
;
uint64_t
total_fwd_delta_nic
;
uint64_t
total_fwd_delta_ports
;
uint64_t
tx_delta
;
slog_obj_name
=
wrsSwcoreStatus_str
;
...
...
@@ -98,20 +102,28 @@ static int get_swcore_status(struct ns_pstats *old,
/* TXFrames and Forwarded described in 2.2.3 "Problem with the
* SwCore or Endpoint HDL module" in wrs_failures document
* shouldn't differ more than FORWARD_DELTA in total */
/* counter Forwarded (38) is implemented in HDL, but does not count PTP
* traffic!!! */
#if 0
total_fwd_delta_ports
=
new
[
i
].
wrsPstatsHCForwarded
-
old
[
i
].
wrsPstatsHCForwarded
;
total_fwd_delta_nic
=
new
[
i
].
wrsPstatsHCNICTXFrames
-
old
[
i
].
wrsPstatsHCNICTXFrames
;
total_fwd_delta
=
total_fwd_delta_ports
+
total_fwd_delta_nic
;
tx_delta
=
new
[
i
].
wrsPstatsHCTXFrames
-
old
[
i
].
wrsPstatsHCTXFrames
;
if
(
/* shouldn't differ more than FORWARD_DELTA */
((
new[i].wrsPstatsHCTXFrames - new[i].wrsPstatsHCForwarded
) > FORWARD_DELTA)
|| ((
new[i].wrsPstatsHCForwarded - new[i].wrsPstatsHCTXFrames
) > FORWARD_DELTA)
((
tx_delta
-
total_fwd_delta
)
>
FORWARD_DELTA
)
||
((
total_fwd_delta
-
tx_delta
)
>
FORWARD_DELTA
)
)
{
/* if error, no need to check more, but do it just for
* logs */
ret
=
1
;
snmp_log(LOG_ERR, "SNMP: wrsSwcoreStatus failed for "
"port %d (wri %d)\n", i + 1, i + 1);
snmp_log
(
LOG_ERR
,
"SNMP: "
SL_ER
" %s: "
"Endpoint TX frames number (%lld) on port %d (wri %d) does not match "
"the number of frames forwarded from other ports (%lld) and NIC (%lld), "
"some frames got lost... Difference is more than %d, since last check (%ds)"
,
slog_obj_name
,
tx_delta
,
i
+
1
,
i
+
1
,
total_fwd_delta_ports
,
total_fwd_delta_nic
,
FORWARD_DELTA
,
(
int
)
t_delta
);
}
#endif
#if 0
/* values from 2.2.5 "Too much HP traffic / Per-priority queue
* full" in wrs_failures document shouldn't change faster
* than parameters defined in dotconfig per second */
...
...
@@ -125,6 +137,7 @@ static int get_swcore_status(struct ns_pstats *old,
SLOG_IF_COMP_WNSG(SL_ER, wrsPstatsHCRXPrio6, new, old, i, t_delta, ns_dotconfig.rx_prio_frame_rate, ret = 1);
SLOG_IF_COMP_WNSG(SL_ER, wrsPstatsHCRXPrio7, new, old, i, t_delta, ns_dotconfig.rx_prio_frame_rate, ret = 1);
SLOG_IF_COMP_WNSG(SL_ER, wrsPstatsHCFastMatchPriority, new, old, i, t_delta, ns_dotconfig.hp_frame_rate, ret = 1);
#endif
}
return
ret
;
}
...
...
userspace/snmpd/wrsNetworkingStatusGroup.h
View file @
720df3c8
...
...
@@ -46,6 +46,10 @@ struct ns_pstats {
uint64_t
wrsPstatsHCRXPCSErrors
;
/* 7 */
uint64_t
wrsPstatsHCRXCRCErrors
;
/* 10 */
/* wrsSwcoreStatus */
/* Problem with the SwCore or Endpoint HDL module */
uint64_t
wrsPstatsHCTXFrames
;
/* 19 */
uint64_t
wrsPstatsHCForwarded
;
/* 38 */
uint64_t
wrsPstatsHCNICTXFrames
;
/* 40 */
/* Too much HP traffic / Per-priority queue full */
uint64_t
wrsPstatsHCRXFrames
;
/* 20 */
uint64_t
wrsPstatsHCRXPrio0
;
/* 22 */
...
...
userspace/snmpd/wrsPstatsHCTable.c
View file @
720df3c8
...
...
@@ -46,6 +46,7 @@ static struct pickinfo wrsPstatsHCTable_pickinfo[] = {
FIELD
(
wrsPstatsHCTable_s
,
ASN_COUNTER64
,
wrsPstatsHCFullMatchRespValid
),
FIELD
(
wrsPstatsHCTable_s
,
ASN_COUNTER64
,
wrsPstatsHCForwarded
),
FIELD
(
wrsPstatsHCTable_s
,
ASN_COUNTER64
,
wrsPstatsHCTRURespValid
),
FIELD
(
wrsPstatsHCTable_s
,
ASN_COUNTER64
,
wrsPstatsHCNICTXFrames
),
};
time_t
...
...
@@ -76,6 +77,7 @@ wrsPstatsHCTable_data_fill(unsigned int *n_rows)
/* fill array with 0xff, buy this it will be easy visible in case
* some counters are invalid */
memset
(
&
pstats_array
,
0xff
,
sizeof
(
pstats_array
));
memset
(
&
counters
,
0xff
,
sizeof
(
counters
));
/* read counters version and number of counters */
f
=
fopen
(
PSTATS_SYSCTL_PATH
PSTATS_SYSCTL_INFO_FILE
,
"r"
);
...
...
@@ -171,6 +173,7 @@ wrsPstatsHCTable_data_fill(unsigned int *n_rows)
pstats_array
[
wrport
].
wrsPstatsHCFullMatchRespValid
=
counters
[
36
];
pstats_array
[
wrport
].
wrsPstatsHCForwarded
=
counters
[
37
];
pstats_array
[
wrport
].
wrsPstatsHCTRURespValid
=
counters
[
38
];
pstats_array
[
wrport
].
wrsPstatsHCNICTXFrames
=
counters
[
39
];
break
;
case
2
:
default:
...
...
userspace/snmpd/wrsPstatsHCTable.h
View file @
720df3c8
...
...
@@ -4,7 +4,7 @@
#define WRSPSTATSHCTABLE_CACHE_TIMEOUT 5
#define WRSPSTATSHCTABLE_OID WRS_OID, 7, 7
#define PSTATS_MAX_N_COUNTERS
39
/* maximum number of counters */
#define PSTATS_MAX_N_COUNTERS
40
/* maximum number of counters */
#define PSTATS_SYSCTL_PATH "/proc/sys/pstats/"
/* Path to sysclt entries */
#define PSTATS_SYSCTL_INFO_FILE "info"
/* file with version of pstats counters
* and number of counters */
...
...
@@ -53,6 +53,7 @@ struct wrsPstatsHCTable_s {
uint64_t
wrsPstatsHCFullMatchRespValid
;
uint64_t
wrsPstatsHCForwarded
;
uint64_t
wrsPstatsHCTRURespValid
;
uint64_t
wrsPstatsHCNICTXFrames
;
};
extern
struct
wrsPstatsHCTable_s
pstats_array
[
WRS_N_PORTS
];
...
...
userspace/tools/wrs_pstats.c
View file @
720df3c8
...
...
@@ -2,7 +2,6 @@
#include<unistd.h>
#include<fpga_io.h>
#include<regs/pstats-regs.h>
// #include<regs/dummy-regs.h>
#include<time.h>
#include<poll.h>
#include <inttypes.h>
...
...
@@ -18,7 +17,7 @@
static
void
parse_sysfs
(
void
);
#define NPORTS 18
#define CNT_PP
39
#define CNT_PP
40
struct
cnt_word
{
uint64_t
cnt
;
...
...
@@ -34,46 +33,47 @@ struct p_cnt {
struct
p_cnt
cnt_pp
[
NPORTS
];
int
use_ports
;
char
info
[][
20
]
=
{{
"Tu-run|"
},
// 0
{
"Ro-run|"
},
// 1
{
"Riv-cd|"
},
// 2
{
"Rsyn-l|"
},
// 3
{
"Rpause|"
},
// 4
{
"Rpf-dp|"
},
// 5
{
"Rpcs-e|"
},
// 6
{
"Rgiant|"
},
// 7
{
"Rrunt |"
},
// 8
{
"Rcrc_e|"
},
// 9
{
"Rpcl_0|"
},
// 10
{
"Rpcl_1|"
},
// 11
{
"Rpcl_2|"
},
// 12
{
"Rpcl_3|"
},
// 13
{
"Rpcl_4|"
},
// 14
{
"Rpcl_5|"
},
// 15
{
"Rpcl_6|"
},
// 16
{
"Rpcl_7|"
},
// 17
{
"Tframe|"
},
// 18
{
"Rframe|"
},
// 19
{
"Rrtu_f|"
},
// 20
{
"Rpri_0|"
},
// 21 -> p0
{
"Rpri_1|"
},
// 22 -> p1
{
"Rpri_2|"
},
// 23 -> p2
{
"Rpri_3|"
},
// 24 -> p3
{
"Rpri_4|"
},
// 25 -> p4
{
"Rpri_5|"
},
// 26 -> p5
{
"Rpri_6|"
},
// 27 -> p6
{
"Rpri_7|"
},
// 28 -> p7
{
"RTUreq|"
},
// 29
{
"RTUrsp|"
},
// 30
{
"RTUdrp|"
},
// 31
{
"RTUhp |"
},
// 32
{
"RTUf-f|"
},
// 33
{
"RTUn-f|"
},
// 34
{
"RTUfst|"
},
// 35
{
"RTUful|"
},
// 36
{
"RTUfwd|"
},
// 37 ---
{
"TRUrsp|"
}
// 38
};
char
info
[][
20
]
=
{{
"Tu-run|"
},
/* 0 */
{
"Ro-run|"
},
/* 1 */
{
"Riv-cd|"
},
/* 2 */
{
"Rsyn-l|"
},
/* 3 */
{
"Rpause|"
},
/* 4 */
{
"Rpf-dp|"
},
/* 5 */
{
"Rpcs-e|"
},
/* 6 */
{
"Rgiant|"
},
/* 7 */
{
"Rrunt |"
},
/* 8 */
{
"Rcrc_e|"
},
/* 9 */
{
"Rpcl_0|"
},
/* 10 */
{
"Rpcl_1|"
},
/* 11 */
{
"Rpcl_2|"
},
/* 12 */
{
"Rpcl_3|"
},
/* 13 */
{
"Rpcl_4|"
},
/* 14 */
{
"Rpcl_5|"
},
/* 15 */
{
"Rpcl_6|"
},
/* 16 */
{
"Rpcl_7|"
},
/* 17 */
{
"Tframe|"
},
/* 18 */
{
"Rframe|"
},
/* 19 */
{
"Rrtu_f|"
},
/* 20 */
{
"Rpri_0|"
},
/* 21 -> p0 */
{
"Rpri_1|"
},
/* 22 -> p1 */
{
"Rpri_2|"
},
/* 23 -> p2 */
{
"Rpri_3|"
},
/* 24 -> p3 */
{
"Rpri_4|"
},
/* 25 -> p4 */
{
"Rpri_5|"
},
/* 26 -> p5 */
{
"Rpri_6|"
},
/* 27 -> p6 */
{
"Rpri_7|"
},
/* 28 -> p7 */
{
"RTUreq|"
},
/* 29 */
{
"RTUrsp|"
},
/* 30 */
{
"RTUdrp|"
},
/* 31 */
{
"RTUhp |"
},
/* 32 */
{
"RTUf-f|"
},
/* 33 */
{
"RTUn-f|"
},
/* 34 */
{
"RTUfst|"
},
/* 35 */
{
"RTUful|"
},
/* 36 */
{
"RTUfwd|"
},
/* 37 */
{
"TRUrsp|"
},
/* 38 */
{
"NIC_Tx|"
}
/* 39 */
};
int
pstats_init
(
int
init
)
{
...
...
@@ -87,9 +87,8 @@ int pstats_init(int init)
printf
(
"module initialized
\n
"
);
for
(
i
=
0
;
i
<
use_ports
;
++
i
)
for
(
j
=
0
;
j
<
CNT_PP
;
++
j
)
{
for
(
i
=
0
;
i
<
use_ports
;
++
i
)
for
(
j
=
0
;
j
<
CNT_PP
;
++
j
)
{
cnt_pp
[
i
].
counters
[
j
].
init
=
0
;
cnt_pp
[
i
].
counters
[
j
].
cnt
=
0
;
}
...
...
@@ -147,16 +146,15 @@ void print_first_n_cnts(int n_cnts)
int
cnt
=
0
;
int
p_index
=
0
;
printf
(
"P |"
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%2d:%s"
,
cnt
,
info
[
cnt
]);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%2d:%s"
,
cnt
,
info
[
cnt
]);
printf
(
"
\n
"
);
printf
(
"----"
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"----------"
);
printf
(
"
\n
"
);
for
(
p_index
=
0
;
p_index
<
use_ports
;
++
p_index
)
{
for
(
p_index
=
0
;
p_index
<
use_ports
;
++
p_index
)
{
printf
(
"%-5s|"
,
cnt_pp
[
p_index
].
if_name
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%9llu|"
,
cnt_pp
[
p_index
].
counters
[
cnt
].
cnt
);
...
...
@@ -164,21 +162,20 @@ void print_first_n_cnts(int n_cnts)
}
}
void
print_chosen_cnts
(
int
cnts_list
[],
int
n_cnts
)
void
print_chosen_cnts
(
int
cnts_list
[],
int
n_cnts
)
{
int
cnt
=
0
;
int
p_index
=
0
;
printf
(
"P |"
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%2d:%s"
,
cnts_list
[
cnt
],
info
[
cnts_list
[
cnt
]]);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%2d:%s"
,
cnts_list
[
cnt
],
info
[
cnts_list
[
cnt
]]);
printf
(
"
\n
"
);
printf
(
"----"
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"----------"
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"----------"
);
printf
(
"
\n
"
);
for
(
p_index
=
0
;
p_index
<
use_ports
;
++
p_index
)
{
for
(
p_index
=
0
;
p_index
<
use_ports
;
++
p_index
)
{
printf
(
"%-5s|"
,
cnt_pp
[
p_index
].
if_name
);
for
(
cnt
=
0
;
cnt
<
n_cnts
;
++
cnt
)
printf
(
"%9llu|"
,
...
...
@@ -205,62 +202,65 @@ void print_info(char *prgname)
int
main
(
int
argc
,
char
**
argv
)
{
int
prio_cnts
[]
=
{
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
};
//8
int
def_cnts
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
};
//30
int
rtu_cnts
[]
=
{
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
};
//10
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
prio_cnts
[]
=
{
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
};
/* 8 */
int
def_cnts
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
39
};
/* 31 */
int
rtu_cnts
[]
=
{
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
};
/* 10 */
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
,
"phsertan:"
))
!=
-
1
)
{
switch
(
c
)
{
case
'n'
:
use_ports
=
atoi
(
optarg
);
break
;
case
'p'
:
case
'e'
:
case
'r'
:
case
'a'
:
case
't'
:
op
=
c
;
break
;
case
's'
:
init
=
2
;
break
;
case
'h'
:
default:
print_info
(
argv
[
0
]);
exit
(
1
);
switch
(
c
)
{
case
'n'
:
use_ports
=
atoi
(
optarg
);
break
;
case
'p'
:
case
'e'
:
case
'r'
:
case
'a'
:
case
't'
:
op
=
c
;
break
;
case
's'
:
init
=
2
;
break
;
case
'h'
:
default:
print_info
(
argv
[
0
]);
exit
(
1
);
}
}
if
(
pstats_init
(
init
))
return
-
1
;
while
(
1
)
{
while
(
1
)
{
printf
(
"
\033
[2J
\033
[1;1H"
);
parse_sysfs
();
switch
(
op
)
{
case
'p'
:
print_chosen_cnts
(
prio_cnts
,
8
);
break
;
case
'e'
:
print_chosen_cnts
(
ep_cnts
,
29
);
break
;
case
'r'
:
print_chosen_cnts
(
rtu_cnts
,
10
);
break
;
case
't'
:
print_chosen_cnts
(
traffic
,
2
);
break
;
case
'a'
:
print_first_n_cnts
(
CNT_PP
);
break
;
default:
print_chosen_cnts
(
def_cnts
,
30
);
switch
(
op
)
{
case
'p'
:
print_chosen_cnts
(
prio_cnts
,
8
);
break
;
case
'e'
:
print_chosen_cnts
(
ep_cnts
,
29
);
break
;
case
'r'
:
print_chosen_cnts
(
rtu_cnts
,
10
);
break
;
case
't'
:
print_chosen_cnts
(
traffic
,
2
);
break
;
case
'a'
:
print_first_n_cnts
(
CNT_PP
);
break
;
default:
print_chosen_cnts
(
def_cnts
,
31
);
}
sleep
(
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