File: vmstat.c

package info (click to toggle)
ruby-vmstat 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 344 kB
  • sloc: ruby: 1,136; ansic: 347; makefile: 3
file content (56 lines) | stat: -rw-r--r-- 1,356 bytes parent folder | download | duplicates (4)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <vmstat.h>
#include <hw/posix.h>
#include <hw/statfs.h>
#include <hw/sysctl.h>
#include <hw/mach.h>
#include <hw/bsd.h>

void Init_vmstat() {
  VALUE vmstat = rb_define_module("Vmstat");

/*
 * Below the list of platform implementations. The Platforms in square
 * brackets are implemented in ruby not in c.
 */

// MAC, FreeBSD, [LINUX]
#if defined(VMSTAT_NETWORK_INTERFACES)
  rb_define_singleton_method(vmstat, "network_interfaces", vmstat_network_interfaces, 0);
#endif

// MAC, FreeBSD, [LINUX]
#if defined(VMSTAT_CPU)
  rb_define_singleton_method(vmstat, "cpu", vmstat_cpu, 0);
#endif

// MAC, FreeBSD, [LINUX]
#if defined(VMSTAT_MEMORY)
  rb_define_singleton_method(vmstat, "memory", vmstat_memory, 0);
#endif

// MAC, FreeBSD, LINUX
#if defined(VMSTAT_DISK)
  rb_define_singleton_method(vmstat, "disk", vmstat_disk, 1);
#endif

// MAC, FreeBSD, LINUX
#if defined(VMSTAT_LOAD_AVERAGE)
  rb_define_singleton_method(vmstat, "load_average", vmstat_load_average, 0);
#endif

// MAC, FreeBSD, [LINUX]
#if defined(VMSTAT_BOOT_TIME)
  rb_define_singleton_method(vmstat, "boot_time", vmstat_boot_time, 0);
#endif

// MAC
#if defined(VMSTAT_TASK)
  rb_define_singleton_method(vmstat, "task", vmstat_task, 0);
#endif

// MAC, FreeBSD, LINUX
#if defined(VMSTAT_PAGESIZE)
  rb_define_singleton_method(vmstat, "pagesize", vmstat_pagesize, 0);
#endif
}