ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/extras/python/statgrab.pyx
(Generate patch)

Comparing projects/libstatgrab/extras/python/statgrab.pyx (file contents):
Revision 1.4 by tdb, Tue Feb 10 20:25:54 2004 UTC vs.
Revision 1.6 by tdb, Fri Feb 13 12:03:29 2004 UTC

# Line 100 | Line 100 | cdef extern from "statgrab.h":
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
# Line 119 | Line 129 | cdef extern from "statgrab.h":
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()
# Line 261 | Line 272 | def py_get_disk_stats():
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,
# Line 284 | Line 295 | def py_get_diskio_stats():
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,
# Line 302 | Line 313 | def py_get_diskio_stats_diff():
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,
# Line 334 | Line 345 | def py_get_network_stats():
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,
# Line 352 | Line 363 | def py_get_network_stats_diff():
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines