100 |
|
long long rx |
101 |
|
time_t systime |
102 |
|
|
103 |
+ |
ctypedef enum duplex: |
104 |
+ |
FULL_DUPLEX |
105 |
+ |
HALF_DUPLEX |
106 |
+ |
NO_DUPLEX |
107 |
+ |
|
108 |
+ |
ctypedef struct network_iface_stat_t: |
109 |
+ |
char *interface_name |
110 |
+ |
int speed |
111 |
+ |
duplex dup |
112 |
+ |
|
113 |
|
ctypedef struct page_stat_t: |
114 |
|
long long pages_pagein |
115 |
|
long long pages_pageout |
129 |
|
cdef extern process_stat_t *get_process_stats() |
130 |
|
cdef extern network_stat_t *get_network_stats(int *entries) |
131 |
|
cdef extern network_stat_t *get_network_stats_diff(int *entries) |
132 |
+ |
cdef extern network_iface_stat_t *get_network_iface_stats(int *entries) |
133 |
|
cdef extern page_stat_t *get_page_stats() |
134 |
|
cdef extern page_stat_t *get_page_stats_diff() |
135 |
|
cdef extern int statgrab_init() |
272 |
|
s = get_disk_stats(&entries) |
273 |
|
if s == NULL: |
274 |
|
raise StatgrabException, 'get_disk_stats() returned NULL' |
275 |
< |
list = [entries] |
275 |
> |
list = [] |
276 |
|
for i from 0 <= i < entries: |
277 |
|
list.append(Result( |
278 |
|
{'device_name': s.device_name, |
295 |
|
s = get_diskio_stats(&entries) |
296 |
|
if s == NULL: |
297 |
|
raise StatgrabException, 'get_diskio_stats() returned NULL' |
298 |
< |
list = [entries] |
298 |
> |
list = [] |
299 |
|
for i from 0 <= i < entries: |
300 |
|
list.append(Result( |
301 |
|
{'disk_name': s.disk_name, |
313 |
|
s = get_diskio_stats_diff(&entries) |
314 |
|
if s == NULL: |
315 |
|
raise StatgrabException, 'get_diskio_stats_diff() returned NULL' |
316 |
< |
list = [entries] |
316 |
> |
list = [] |
317 |
|
for i from 0 <= i < entries: |
318 |
|
list.append(Result( |
319 |
|
{'disk_name': s.disk_name, |
345 |
|
s = get_network_stats(&entries) |
346 |
|
if s == NULL: |
347 |
|
raise StatgrabException, 'get_network_stats() returned NULL' |
348 |
< |
list = [entries] |
348 |
> |
list = [] |
349 |
|
for i from 0 <= i < entries: |
350 |
|
list.append(Result( |
351 |
|
{'interface_name': s.interface_name, |
363 |
|
s = get_network_stats_diff(&entries) |
364 |
|
if s == NULL: |
365 |
|
raise StatgrabException, 'get_network_stats_diff() returned NULL' |
366 |
< |
list = [entries] |
366 |
> |
list = [] |
367 |
|
for i from 0 <= i < entries: |
368 |
|
list.append(Result( |
369 |
|
{'interface_name': s.interface_name, |
370 |
|
'tx': s.tx, |
371 |
|
'rx': s.rx, |
372 |
|
'systime': s.systime, |
373 |
+ |
} |
374 |
+ |
)) |
375 |
+ |
s = s + 1 |
376 |
+ |
return list |
377 |
+ |
|
378 |
+ |
def py_get_network_iface_stats(): |
379 |
+ |
cdef network_iface_stat_t *s |
380 |
+ |
cdef int entries |
381 |
+ |
s = get_network_iface_stats(&entries) |
382 |
+ |
if s == NULL: |
383 |
+ |
raise StatgrabException, 'get_network_iface_stats() returned NULL' |
384 |
+ |
list = [] |
385 |
+ |
for i from 0 <= i < entries: |
386 |
+ |
list.append(Result( |
387 |
+ |
{'interface_name': s.interface_name, |
388 |
+ |
'speed': s.speed, |
389 |
+ |
'dup': s.dup, |
390 |
|
} |
391 |
|
)) |
392 |
|
s = s + 1 |