100 |
|
long long rx |
101 |
|
time_t systime |
102 |
|
|
103 |
< |
ctypedef enum duplex: |
103 |
> |
ctypedef enum statgrab_duplex: |
104 |
|
FULL_DUPLEX |
105 |
|
HALF_DUPLEX |
106 |
< |
NO_DUPLEX |
106 |
> |
UNKNOWN_DUPLEX |
107 |
|
|
108 |
|
ctypedef struct network_iface_stat_t: |
109 |
|
char *interface_name |
110 |
|
int speed |
111 |
< |
duplex dup |
111 |
> |
statgrab_duplex dup |
112 |
|
|
113 |
|
ctypedef struct page_stat_t: |
114 |
|
long long pages_pagein |
136 |
|
cdef extern int statgrab_drop_privileges() |
137 |
|
|
138 |
|
|
139 |
+ |
py_FULL_DUPLEX = FULL_DUPLEX |
140 |
+ |
py_HALF_DUPLEX = HALF_DUPLEX |
141 |
+ |
py_UNKNOWN_DUPLEX = UNKNOWN_DUPLEX |
142 |
+ |
|
143 |
+ |
|
144 |
|
class Result: |
145 |
|
def __init__(self, attrs): |
146 |
|
self.attrs = attrs |
277 |
|
s = get_disk_stats(&entries) |
278 |
|
if s == NULL: |
279 |
|
raise StatgrabException, 'get_disk_stats() returned NULL' |
280 |
< |
list = [entries] |
280 |
> |
list = [] |
281 |
|
for i from 0 <= i < entries: |
282 |
|
list.append(Result( |
283 |
|
{'device_name': s.device_name, |
300 |
|
s = get_diskio_stats(&entries) |
301 |
|
if s == NULL: |
302 |
|
raise StatgrabException, 'get_diskio_stats() returned NULL' |
303 |
< |
list = [entries] |
303 |
> |
list = [] |
304 |
|
for i from 0 <= i < entries: |
305 |
|
list.append(Result( |
306 |
|
{'disk_name': s.disk_name, |
318 |
|
s = get_diskio_stats_diff(&entries) |
319 |
|
if s == NULL: |
320 |
|
raise StatgrabException, 'get_diskio_stats_diff() returned NULL' |
321 |
< |
list = [entries] |
321 |
> |
list = [] |
322 |
|
for i from 0 <= i < entries: |
323 |
|
list.append(Result( |
324 |
|
{'disk_name': s.disk_name, |
350 |
|
s = get_network_stats(&entries) |
351 |
|
if s == NULL: |
352 |
|
raise StatgrabException, 'get_network_stats() returned NULL' |
353 |
< |
list = [entries] |
353 |
> |
list = [] |
354 |
|
for i from 0 <= i < entries: |
355 |
|
list.append(Result( |
356 |
|
{'interface_name': s.interface_name, |
368 |
|
s = get_network_stats_diff(&entries) |
369 |
|
if s == NULL: |
370 |
|
raise StatgrabException, 'get_network_stats_diff() returned NULL' |
371 |
< |
list = [entries] |
371 |
> |
list = [] |
372 |
|
for i from 0 <= i < entries: |
373 |
|
list.append(Result( |
374 |
|
{'interface_name': s.interface_name, |
386 |
|
s = get_network_iface_stats(&entries) |
387 |
|
if s == NULL: |
388 |
|
raise StatgrabException, 'get_network_iface_stats() returned NULL' |
389 |
< |
list = [entries] |
389 |
> |
list = [] |
390 |
|
for i from 0 <= i < entries: |
391 |
|
list.append(Result( |
392 |
|
{'interface_name': s.interface_name, |