sigar 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -4
- data/bindings/SigarWrapper.pm +47 -0
- data/include/sigar.h +41 -0
- data/include/sigar_private.h +7 -2
- data/include/sigar_util.h +6 -0
- data/src/os/aix/aix_sigar.c +17 -0
- data/src/os/darwin/darwin_sigar.c +20 -13
- data/src/os/hpux/hpux_sigar.c +19 -0
- data/src/os/linux/linux_sigar.c +28 -0
- data/src/os/solaris/solaris_sigar.c +16 -1
- data/src/os/win32/sigar_os.h +2 -0
- data/src/os/win32/win32_sigar.c +50 -6
- data/src/sigar.c +131 -115
- data/src/sigar_cache.c +81 -7
- data/src/sigar_ptql.c +9 -0
- metadata +3 -23
- data/bindings/ruby/examples/arp.rb +0 -24
- data/bindings/ruby/examples/cpu_info.rb +0 -35
- data/bindings/ruby/examples/df.rb +0 -49
- data/bindings/ruby/examples/free.rb +0 -36
- data/bindings/ruby/examples/ifconfig.rb +0 -101
- data/bindings/ruby/examples/logging.rb +0 -58
- data/bindings/ruby/examples/net_info.rb +0 -31
- data/bindings/ruby/examples/netstat.rb +0 -71
- data/bindings/ruby/examples/pargs.rb +0 -35
- data/bindings/ruby/examples/penv.rb +0 -31
- data/bindings/ruby/examples/route.rb +0 -48
- data/bindings/ruby/examples/version.rb +0 -40
- data/bindings/ruby/examples/who.rb +0 -30
- data/bindings/ruby/test/cpu_test.rb +0 -40
- data/bindings/ruby/test/file_system_test.rb +0 -43
- data/bindings/ruby/test/helper.rb +0 -57
- data/bindings/ruby/test/loadavg_test.rb +0 -30
- data/bindings/ruby/test/mem_test.rb +0 -45
- data/bindings/ruby/test/swap_test.rb +0 -36
- data/bindings/ruby/test/uptime_test.rb +0 -26
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'rubygems/package_task'
|
3
3
|
require 'rake/testtask'
|
4
4
|
|
5
5
|
#so we can: ssh host rake -f $hudson_workspace/sigar/Rakefile
|
@@ -22,7 +22,7 @@ spec = Gem::Specification.new do |s|
|
|
22
22
|
s.name = GEM
|
23
23
|
# s.version = props['version.major'] + '.' + props['version.minor'] + '.' + props['version.maint']
|
24
24
|
# '0.7.x' until the sigar-1.7.0 release
|
25
|
-
s.version = '0' + '.' + props['version.minor'] + '.' + '
|
25
|
+
s.version = '0' + '.' + props['version.minor'] + '.' + '3'
|
26
26
|
s.summary = props['project.summary']
|
27
27
|
s.description = s.summary
|
28
28
|
s.author = props['project.author']
|
@@ -34,13 +34,13 @@ spec = Gem::Specification.new do |s|
|
|
34
34
|
s.files =
|
35
35
|
%w(LICENSE NOTICE README Rakefile version.properties) +
|
36
36
|
%w(bindings/SigarWrapper.pm bindings/SigarBuild.pm) +
|
37
|
-
`git ls-files -- bindings/ruby
|
37
|
+
`git ls-files -- bindings/ruby/*.*`.split("\n") +
|
38
38
|
Dir.glob("include/*.h") +
|
39
39
|
Dir.glob("src/**/*.[ch]") +
|
40
40
|
Dir.glob("src/**/*.in")
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
Gem::PackageTask.new(spec) do |pkg|
|
44
44
|
pkg.gem_spec = spec
|
45
45
|
end
|
46
46
|
|
data/bindings/SigarWrapper.pm
CHANGED
@@ -43,6 +43,7 @@ my %has_name_arg = map { $_, 1 } qw(FileSystemUsage DiskUsage
|
|
43
43
|
FileAttrs DirStat DirUsage
|
44
44
|
NetInterfaceConfig NetInterfaceStat);
|
45
45
|
|
46
|
+
|
46
47
|
my %proc_no_arg = map { $_, 1 } qw(stat);
|
47
48
|
|
48
49
|
my %get_not_impl = map { $_, 1 } qw(net_address net_route net_connection net_stat cpu_perc
|
@@ -527,6 +528,7 @@ use vars qw(%classes %cmds);
|
|
527
528
|
plat => '*'
|
528
529
|
},
|
529
530
|
],
|
531
|
+
|
530
532
|
ProcMem => [
|
531
533
|
{
|
532
534
|
name => 'size', type => 'Long',
|
@@ -627,6 +629,51 @@ use vars qw(%classes %cmds);
|
|
627
629
|
plat => '*'
|
628
630
|
},
|
629
631
|
],
|
632
|
+
ProcDiskIO => [
|
633
|
+
{
|
634
|
+
name => 'bytes_read', type => 'Long',
|
635
|
+
desc => 'Bytes Read',
|
636
|
+
plat => 'LW'
|
637
|
+
},
|
638
|
+
{
|
639
|
+
name => 'bytes_written', type => 'Long',
|
640
|
+
desc => 'Bytes Written',
|
641
|
+
plat => 'LW'
|
642
|
+
},
|
643
|
+
{
|
644
|
+
name => 'bytes_total', type => 'Long',
|
645
|
+
desc => 'Bytes Total',
|
646
|
+
plat => 'LWAHS'
|
647
|
+
}
|
648
|
+
],
|
649
|
+
|
650
|
+
ProcCumulativeDiskIO => [
|
651
|
+
{
|
652
|
+
name => 'bytes_read', type => 'Long',
|
653
|
+
desc => 'Bytes Read from Start',
|
654
|
+
plat => 'LW'
|
655
|
+
},
|
656
|
+
{
|
657
|
+
name => 'bytes_written', type => 'Long',
|
658
|
+
desc => 'Bytes Written from Start',
|
659
|
+
plat => 'LW'
|
660
|
+
},
|
661
|
+
{
|
662
|
+
name => 'bytes_total', type => 'Long',
|
663
|
+
desc => 'Bytes Total from Start',
|
664
|
+
plat => 'LWAHS'
|
665
|
+
}
|
666
|
+
],
|
667
|
+
|
668
|
+
DumpPidCache => [
|
669
|
+
{
|
670
|
+
name => 'dummy', type => 'Long',
|
671
|
+
desc => 'Dummy',
|
672
|
+
plat => 'LWAHS'
|
673
|
+
}
|
674
|
+
],
|
675
|
+
|
676
|
+
|
630
677
|
ProcState => [
|
631
678
|
{
|
632
679
|
name => 'state', type => 'Char',
|
data/include/sigar.h
CHANGED
@@ -292,6 +292,47 @@ typedef struct {
|
|
292
292
|
SIGAR_DECLARE(int) sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
|
293
293
|
sigar_proc_mem_t *procmem);
|
294
294
|
|
295
|
+
typedef struct {
|
296
|
+
sigar_uint64_t
|
297
|
+
bytes_read,
|
298
|
+
bytes_written,
|
299
|
+
bytes_total;
|
300
|
+
} sigar_proc_disk_io_t;
|
301
|
+
|
302
|
+
SIGAR_DECLARE(int) sigar_proc_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
303
|
+
sigar_proc_disk_io_t *proc_disk_io);
|
304
|
+
|
305
|
+
typedef struct {
|
306
|
+
sigar_uint64_t
|
307
|
+
bytes_read,
|
308
|
+
bytes_written,
|
309
|
+
bytes_total;
|
310
|
+
sigar_uint64_t last_time;
|
311
|
+
sigar_uint64_t
|
312
|
+
bytes_read_diff,
|
313
|
+
bytes_written_diff,
|
314
|
+
bytes_total_diff;
|
315
|
+
} sigar_cached_proc_disk_io_t;
|
316
|
+
|
317
|
+
|
318
|
+
typedef struct {
|
319
|
+
sigar_uint64_t
|
320
|
+
bytes_read,
|
321
|
+
bytes_written,
|
322
|
+
bytes_total;
|
323
|
+
} sigar_proc_cumulative_disk_io_t;
|
324
|
+
|
325
|
+
SIGAR_DECLARE(int) sigar_proc_cumulative_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
326
|
+
sigar_proc_cumulative_disk_io_t *proc_cumulative_disk_io);
|
327
|
+
|
328
|
+
|
329
|
+
typedef struct {
|
330
|
+
sigar_uint64_t dummy;
|
331
|
+
}sigar_dump_pid_cache_t;
|
332
|
+
|
333
|
+
SIGAR_DECLARE(int) sigar_dump_pid_cache_get(sigar_t *sigar, sigar_dump_pid_cache_t *info);
|
334
|
+
|
335
|
+
|
295
336
|
typedef struct {
|
296
337
|
sigar_uid_t uid;
|
297
338
|
sigar_gid_t gid;
|
data/include/sigar_private.h
CHANGED
@@ -68,7 +68,8 @@
|
|
68
68
|
sigar_cache_t *proc_cpu; \
|
69
69
|
sigar_cache_t *net_listen; \
|
70
70
|
sigar_cache_t *net_services_tcp; \
|
71
|
-
sigar_cache_t *net_services_udp
|
71
|
+
sigar_cache_t *net_services_udp;\
|
72
|
+
sigar_cache_t *proc_io
|
72
73
|
|
73
74
|
#if defined(WIN32)
|
74
75
|
# define SIGAR_INLINE __inline
|
@@ -398,11 +399,15 @@ int sigar_get_iftype(const char *name, int *type, int *inst);
|
|
398
399
|
#define SIGAR_NIC_SIT "IPv6-in-IPv4"
|
399
400
|
#define SIGAR_NIC_IRDA "IrLAP"
|
400
401
|
#define SIGAR_NIC_EC "Econet"
|
401
|
-
|
402
|
+
#define PID_CACHE_CLEANUP_PERIOD 1000*60*10 /* 10 minutes */
|
403
|
+
#define PID_CACHE_ENTRY_EXPIRE_PERIOD 1000*60*20 /* 20 minutes */
|
402
404
|
#ifndef WIN32
|
403
405
|
#include <netdb.h>
|
404
406
|
#endif
|
405
407
|
|
408
|
+
#define PROC_PID_CPU_CACHE 1
|
409
|
+
#define PROC_PID_IO_CACHE 2
|
410
|
+
|
406
411
|
#define SIGAR_HOSTENT_LEN 1024
|
407
412
|
#if defined(_AIX)
|
408
413
|
#define SIGAR_HAS_HOSTENT_DATA
|
data/include/sigar_util.h
CHANGED
@@ -170,15 +170,21 @@ struct sigar_cache_entry_t {
|
|
170
170
|
sigar_cache_entry_t *next;
|
171
171
|
sigar_uint64_t id;
|
172
172
|
void *value;
|
173
|
+
sigar_uint64_t last_access_time;
|
173
174
|
};
|
174
175
|
|
175
176
|
typedef struct {
|
176
177
|
sigar_cache_entry_t **entries;
|
177
178
|
unsigned int count, size;
|
178
179
|
void (*free_value)(void *ptr);
|
180
|
+
sigar_uint64_t entry_expire_period;
|
181
|
+
sigar_uint64_t cleanup_period_millis;
|
182
|
+
sigar_uint64_t last_cleanup_time;
|
179
183
|
} sigar_cache_t;
|
180
184
|
|
181
185
|
sigar_cache_t *sigar_cache_new(int size);
|
186
|
+
sigar_cache_t *sigar_expired_cache_new(int size, sigar_uint64_t cleanup_period_millis, sigar_uint64_t entry_expire_period);
|
187
|
+
void sigar_cache_dump(sigar_cache_t *table);
|
182
188
|
|
183
189
|
sigar_cache_entry_t *sigar_cache_get(sigar_cache_t *table,
|
184
190
|
sigar_uint64_t key);
|
data/src/os/aix/aix_sigar.c
CHANGED
@@ -754,6 +754,23 @@ int sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
|
|
754
754
|
return SIGAR_OK;
|
755
755
|
}
|
756
756
|
|
757
|
+
int sigar_proc_cumulative_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
758
|
+
sigar_proc_cumulative_disk_io_t *cumulative_proc_disk_io)
|
759
|
+
{
|
760
|
+
int status = sigar_getprocs(sigar, pid);
|
761
|
+
struct procsinfo64 *pinfo = sigar->pinfo;
|
762
|
+
|
763
|
+
if (status != SIGAR_OK) {
|
764
|
+
return status;
|
765
|
+
}
|
766
|
+
cumulative_proc_disk_io->bytes_read = SIGAR_FIELD_NOTIMPL;
|
767
|
+
cumulative_proc_disk_io->bytes_written = SIGAR_FIELD_NOTIMPL;
|
768
|
+
cumulative_proc_disk_io->bytes_total = pinfo->pi_ioch;
|
769
|
+
|
770
|
+
return SIGAR_OK;
|
771
|
+
}
|
772
|
+
|
773
|
+
|
757
774
|
int sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid,
|
758
775
|
sigar_proc_cred_t *proccred)
|
759
776
|
{
|
@@ -16,11 +16,6 @@
|
|
16
16
|
* limitations under the License.
|
17
17
|
*/
|
18
18
|
|
19
|
-
#include "sigar.h"
|
20
|
-
#include "sigar_private.h"
|
21
|
-
#include "sigar_util.h"
|
22
|
-
#include "sigar_os.h"
|
23
|
-
|
24
19
|
#include <sys/param.h>
|
25
20
|
#include <sys/mount.h>
|
26
21
|
#if !(defined(__FreeBSD__) && (__FreeBSD_version >= 800000))
|
@@ -66,14 +61,6 @@
|
|
66
61
|
#include <stdio.h>
|
67
62
|
#endif
|
68
63
|
|
69
|
-
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013)
|
70
|
-
#define SIGAR_FREEBSD5_NFSSTAT
|
71
|
-
#include <nfsclient/nfs.h>
|
72
|
-
#include <nfsserver/nfs.h>
|
73
|
-
#else
|
74
|
-
#include <nfs/nfs.h>
|
75
|
-
#endif
|
76
|
-
|
77
64
|
#include <sys/ioctl.h>
|
78
65
|
#include <sys/mount.h>
|
79
66
|
#include <sys/resource.h>
|
@@ -88,6 +75,14 @@
|
|
88
75
|
#include <netinet/in.h>
|
89
76
|
#include <netinet/if_ether.h>
|
90
77
|
|
78
|
+
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013)
|
79
|
+
#define SIGAR_FREEBSD5_NFSSTAT
|
80
|
+
#include <nfsclient/nfs.h>
|
81
|
+
#include <nfsserver/nfs.h>
|
82
|
+
#else
|
83
|
+
#include <nfs/nfs.h>
|
84
|
+
#endif
|
85
|
+
|
91
86
|
#include <dirent.h>
|
92
87
|
#include <errno.h>
|
93
88
|
|
@@ -112,6 +107,11 @@
|
|
112
107
|
#include <netinet/tcp_var.h>
|
113
108
|
#include <netinet/tcp_fsm.h>
|
114
109
|
|
110
|
+
#include "sigar.h"
|
111
|
+
#include "sigar_private.h"
|
112
|
+
#include "sigar_util.h"
|
113
|
+
#include "sigar_os.h"
|
114
|
+
|
115
115
|
#define NMIB(mib) (sizeof(mib)/sizeof(mib[0]))
|
116
116
|
|
117
117
|
#ifdef __FreeBSD__
|
@@ -1241,6 +1241,13 @@ int sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
|
|
1241
1241
|
return SIGAR_OK;
|
1242
1242
|
}
|
1243
1243
|
|
1244
|
+
int sigar_proc_cumulative_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
1245
|
+
sigar_proc_cumulative_disk_io_t *proc_cumulative_disk_io)
|
1246
|
+
{
|
1247
|
+
return SIGAR_ENOTIMPL;
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
|
1244
1251
|
int sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid,
|
1245
1252
|
sigar_proc_cred_t *proccred)
|
1246
1253
|
{
|
data/src/os/hpux/hpux_sigar.c
CHANGED
@@ -307,6 +307,25 @@ int sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
|
|
307
307
|
return SIGAR_OK;
|
308
308
|
}
|
309
309
|
|
310
|
+
int sigar_proc_cumulative_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
311
|
+
sigar_proc_cumulative_disk_io_t *proc_cumulative_disk_io)
|
312
|
+
{
|
313
|
+
|
314
|
+
int status = sigar_pstat_getproc(sigar, pid);
|
315
|
+
struct pst_status *pinfo = sigar->pinfo;
|
316
|
+
|
317
|
+
if (status != SIGAR_OK) {
|
318
|
+
return status;
|
319
|
+
}
|
320
|
+
proc_cumulative_disk_io->bytes_read = SIGAR_FIELD_NOTIMPL;
|
321
|
+
proc_cumulative_disk_io->bytes_written = SIGAR_FIELD_NOTIMPL;
|
322
|
+
proc_cumulative_disk_io->bytes_total = pinfo->pst_ioch;
|
323
|
+
|
324
|
+
|
325
|
+
return SIGAR_OK;
|
326
|
+
}
|
327
|
+
|
328
|
+
|
310
329
|
int sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid,
|
311
330
|
sigar_proc_cred_t *proccred)
|
312
331
|
{
|
data/src/os/linux/linux_sigar.c
CHANGED
@@ -768,6 +768,34 @@ int sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
|
|
768
768
|
return SIGAR_OK;
|
769
769
|
}
|
770
770
|
|
771
|
+
SIGAR_INLINE sigar_uint64_t get_named_proc_token(char *buffer,
|
772
|
+
char *token) {
|
773
|
+
char *ptr = strstr(buffer, token);
|
774
|
+
if (!ptr) {
|
775
|
+
return SIGAR_FIELD_NOTIMPL;
|
776
|
+
}
|
777
|
+
ptr = sigar_skip_token(ptr);
|
778
|
+
return sigar_strtoul(ptr);
|
779
|
+
}
|
780
|
+
|
781
|
+
int sigar_proc_cumulative_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
782
|
+
sigar_proc_cumulative_disk_io_t *proc_cumulative_disk_io)
|
783
|
+
{
|
784
|
+
char buffer[BUFSIZ];
|
785
|
+
|
786
|
+
int status = SIGAR_PROC_FILE2STR(buffer, pid, "/io");
|
787
|
+
|
788
|
+
if (status != SIGAR_OK) {
|
789
|
+
return status;
|
790
|
+
}
|
791
|
+
|
792
|
+
proc_cumulative_disk_io->bytes_read = get_named_proc_token(buffer, "\nread_bytes");
|
793
|
+
proc_cumulative_disk_io->bytes_written = get_named_proc_token(buffer, "\nwrite_bytes");
|
794
|
+
proc_cumulative_disk_io->bytes_total = proc_cumulative_disk_io->bytes_read + proc_cumulative_disk_io->bytes_written;
|
795
|
+
|
796
|
+
return SIGAR_OK;
|
797
|
+
}
|
798
|
+
|
771
799
|
#define NO_ID_MSG "[proc_cred] /proc/%lu" PROC_PSTATUS " missing "
|
772
800
|
|
773
801
|
int sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid,
|
@@ -407,7 +407,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
|
|
407
407
|
cpu->idle += xcpu->idle;
|
408
408
|
cpu->nice += xcpu->nice;
|
409
409
|
cpu->wait += xcpu->wait;
|
410
|
-
cpu->total
|
410
|
+
cpu->total += xcpu->total;
|
411
411
|
}
|
412
412
|
|
413
413
|
return SIGAR_OK;
|
@@ -719,6 +719,21 @@ int sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
|
|
719
719
|
return SIGAR_OK;
|
720
720
|
}
|
721
721
|
|
722
|
+
int sigar_proc_cumulative_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
723
|
+
sigar_proc_cumulative_disk_io_t *proc_cumulative_disk_io)
|
724
|
+
{
|
725
|
+
prusage_t usage;
|
726
|
+
int status;
|
727
|
+
if ((status = sigar_proc_usage_get(sigar, &usage, pid)) != SIGAR_OK) {
|
728
|
+
return status;
|
729
|
+
}
|
730
|
+
proc_cumulative_disk_io->bytes_read = SIGAR_FIELD_NOTIMPL;
|
731
|
+
proc_cumulative_disk_io->bytes_written = SIGAR_FIELD_NOTIMPL;
|
732
|
+
proc_cumulative_disk_io->bytes_total = usage.pr_ioch;
|
733
|
+
|
734
|
+
return SIGAR_OK;
|
735
|
+
}
|
736
|
+
|
722
737
|
int sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid,
|
723
738
|
sigar_proc_cred_t *proccred)
|
724
739
|
{
|
data/src/os/win32/sigar_os.h
CHANGED
data/src/os/win32/win32_sigar.c
CHANGED
@@ -62,6 +62,8 @@ typedef enum {
|
|
62
62
|
#define PERF_TITLE_PPID 1410
|
63
63
|
#define PERF_TITLE_PRIORITY 682
|
64
64
|
#define PERF_TITLE_START_TIME 684
|
65
|
+
#define PERF_TITLE_IO_READ_BYTES_SEC 1420
|
66
|
+
#define PERF_TITLE_IO_WRITE_BYTES_SEC 1422
|
65
67
|
|
66
68
|
typedef enum {
|
67
69
|
PERF_IX_CPUTIME,
|
@@ -74,6 +76,8 @@ typedef enum {
|
|
74
76
|
PERF_IX_PPID,
|
75
77
|
PERF_IX_PRIORITY,
|
76
78
|
PERF_IX_START_TIME,
|
79
|
+
PERF_IX_IO_READ_BYTES_SEC,
|
80
|
+
PERF_IX_IO_WRITE_BYTES_SEC,
|
77
81
|
PERF_IX_MAX
|
78
82
|
} perf_proc_offsets_t;
|
79
83
|
|
@@ -1210,6 +1214,23 @@ SIGAR_DECLARE(int) sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
|
|
1210
1214
|
return SIGAR_OK;
|
1211
1215
|
}
|
1212
1216
|
|
1217
|
+
SIGAR_DECLARE(int) sigar_proc_cumulative_disk_io_get(sigar_t *sigar, sigar_pid_t pid,
|
1218
|
+
sigar_proc_cumulative_disk_io_t *proc_cumulative_disk_io)
|
1219
|
+
{
|
1220
|
+
int status = get_proc_info(sigar, pid);
|
1221
|
+
sigar_win32_pinfo_t *pinfo = &sigar->pinfo;
|
1222
|
+
|
1223
|
+
if (status != SIGAR_OK) {
|
1224
|
+
return status;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
proc_cumulative_disk_io->bytes_read = pinfo->bytes_read;
|
1228
|
+
proc_cumulative_disk_io->bytes_written = pinfo->bytes_written;
|
1229
|
+
proc_cumulative_disk_io->bytes_total = proc_cumulative_disk_io->bytes_read + proc_cumulative_disk_io->bytes_written;
|
1230
|
+
|
1231
|
+
return SIGAR_OK;
|
1232
|
+
}
|
1233
|
+
|
1213
1234
|
#define TOKEN_DAC (STANDARD_RIGHTS_READ | READ_CONTROL | TOKEN_QUERY)
|
1214
1235
|
|
1215
1236
|
SIGAR_DECLARE(int)
|
@@ -1441,6 +1462,12 @@ static int get_proc_info(sigar_t *sigar, sigar_pid_t pid)
|
|
1441
1462
|
case PERF_TITLE_START_TIME:
|
1442
1463
|
perf_offsets[PERF_IX_START_TIME] = offset;
|
1443
1464
|
break;
|
1465
|
+
case PERF_TITLE_IO_READ_BYTES_SEC:
|
1466
|
+
perf_offsets[PERF_IX_IO_READ_BYTES_SEC] = offset;
|
1467
|
+
break;
|
1468
|
+
case PERF_TITLE_IO_WRITE_BYTES_SEC:
|
1469
|
+
perf_offsets[PERF_IX_IO_WRITE_BYTES_SEC] = offset;
|
1470
|
+
break;
|
1444
1471
|
}
|
1445
1472
|
}
|
1446
1473
|
|
@@ -1466,6 +1493,8 @@ static int get_proc_info(sigar_t *sigar, sigar_pid_t pid)
|
|
1466
1493
|
pinfo->handles = PERF_VAL(PERF_IX_HANDLE_CNT);
|
1467
1494
|
pinfo->threads = PERF_VAL(PERF_IX_THREAD_CNT);
|
1468
1495
|
pinfo->page_faults = PERF_VAL(PERF_IX_PAGE_FAULTS);
|
1496
|
+
pinfo->bytes_read = PERF_VAL(PERF_IX_IO_READ_BYTES_SEC);
|
1497
|
+
pinfo->bytes_written = PERF_VAL(PERF_IX_IO_WRITE_BYTES_SEC);
|
1469
1498
|
|
1470
1499
|
return SIGAR_OK;
|
1471
1500
|
}
|
@@ -3693,6 +3722,7 @@ int sigar_who_list_get_win32(sigar_t *sigar,
|
|
3693
3722
|
#define SIGAR_ARCH "x86"
|
3694
3723
|
#endif
|
3695
3724
|
|
3725
|
+
|
3696
3726
|
int sigar_os_sys_info_get(sigar_t *sigar,
|
3697
3727
|
sigar_sys_info_t *sysinfo)
|
3698
3728
|
{
|
@@ -3700,7 +3730,7 @@ int sigar_os_sys_info_get(sigar_t *sigar,
|
|
3700
3730
|
char *vendor_name, *vendor_version, *code_name=NULL;
|
3701
3731
|
|
3702
3732
|
version.dwOSVersionInfoSize = sizeof(version);
|
3703
|
-
GetVersionEx((OSVERSIONINFO *)&version);
|
3733
|
+
GetVersionEx((OSVERSIONINFO *)&version);
|
3704
3734
|
|
3705
3735
|
if (version.dwMajorVersion == 4) {
|
3706
3736
|
vendor_name = "Windows NT";
|
@@ -3740,11 +3770,25 @@ int sigar_os_sys_info_get(sigar_t *sigar,
|
|
3740
3770
|
code_name = "Vienna";
|
3741
3771
|
}
|
3742
3772
|
}
|
3743
|
-
|
3744
|
-
|
3745
|
-
|
3746
|
-
|
3747
|
-
|
3773
|
+
else {
|
3774
|
+
// not nt work station
|
3775
|
+
if (version.dwMinorVersion == 0 || version.dwMinorVersion ==1) {
|
3776
|
+
vendor_name = "Windows 2008";
|
3777
|
+
vendor_version = "2008";
|
3778
|
+
code_name = "Longhorn Server";
|
3779
|
+
}
|
3780
|
+
else if (version.dwMinorVersion == 2) {
|
3781
|
+
vendor_name = "Windows 2012";
|
3782
|
+
vendor_version = "2012";
|
3783
|
+
code_name = "Windows Server 8";
|
3784
|
+
}
|
3785
|
+
else {
|
3786
|
+
// defaults
|
3787
|
+
vendor_name = "Windows Unknown";
|
3788
|
+
vendor_version = "2012";
|
3789
|
+
}
|
3790
|
+
}
|
3791
|
+
|
3748
3792
|
}
|
3749
3793
|
|
3750
3794
|
SIGAR_SSTRCPY(sysinfo->name, "Win32");
|