2 * collectd - src/processes.c
3 * Copyright (C) 2005 Lyonel Vincent
4 * Copyright (C) 2006 Florian Forster (Mach code)
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * Lyonel Vincent <lyonel at ezix.org>
22 * Florian octo Forster <octo at verplant.org>
28 #include "utils_debug.h"
29 #include "configfile.h"
31 /* Include header files for the mach system, if they exist.. */
33 # if HAVE_MACH_MACH_INIT_H
34 # include <mach/mach_init.h>
36 # if HAVE_MACH_HOST_PRIV_H
37 # include <mach/host_priv.h>
39 # if HAVE_MACH_MACH_ERROR_H
40 # include <mach/mach_error.h>
42 # if HAVE_MACH_MACH_HOST_H
43 # include <mach/mach_host.h>
45 # if HAVE_MACH_MACH_PORT_H
46 # include <mach/mach_port.h>
48 # if HAVE_MACH_MACH_TYPES_H
49 # include <mach/mach_types.h>
51 # if HAVE_MACH_MESSAGE_H
52 # include <mach/message.h>
54 # if HAVE_MACH_PROCESSOR_SET_H
55 # include <mach/processor_set.h>
58 # include <mach/task.h>
60 # if HAVE_MACH_THREAD_ACT_H
61 # include <mach/thread_act.h>
63 # if HAVE_MACH_VM_REGION_H
64 # include <mach/vm_region.h>
66 # if HAVE_MACH_VM_MAP_H
67 # include <mach/vm_map.h>
69 # if HAVE_MACH_VM_PROT_H
70 # include <mach/vm_prot.h>
72 /* #endif HAVE_THREAD_INFO */
75 # if HAVE_LINUX_CONFIG_H
76 # include <linux/config.h>
79 # define CONFIG_HZ 100
81 #endif /* KERNEL_LINUX */
83 #define MODULE_NAME "processes"
85 #if HAVE_THREAD_INFO || KERNEL_LINUX
86 # define PROCESSES_HAVE_READ 1
88 # define PROCESSES_HAVE_READ 0
93 static char *processes_file = "processes.rrd";
94 static char *processes_ds_def[] =
96 "DS:running:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
97 "DS:sleeping:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
98 "DS:zombies:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
99 "DS:stopped:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
100 "DS:paging:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
101 "DS:blocked:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
104 static int processes_ds_num = 6;
106 static char *ps_rss_file = "processes/ps_rss-%s.rrd";
107 static char *ps_rss_ds_def[] =
110 "DS:byte:GAUGE:"COLLECTD_HEARTBEAT":0:9223372036854775807",
113 static int ps_rss_ds_num = 1;
115 static char *ps_cputime_file = "processes/ps_cputime-%s.rrd";
116 static char *ps_cputime_ds_def[] =
118 /* 1 second in user-mode per second ought to be enough.. */
119 "DS:user:COUNTER:"COLLECTD_HEARTBEAT":0:1000000",
120 "DS:syst:COUNTER:"COLLECTD_HEARTBEAT":0:1000000",
123 static int ps_cputime_ds_num = 2;
125 static char *ps_count_file = "processes/ps_count-%s.rrd";
126 static char *ps_count_ds_def[] =
128 "DS:processes:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
129 "DS:threads:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
132 static int ps_count_ds_num = 2;
134 static char *ps_pagefaults_file = "processes/ps_pagefaults-%s.rrd";
135 static char *ps_pagefaults_ds_def[] =
138 "DS:minflt:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
139 "DS:majflt:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
142 static int ps_pagefaults_ds_num = 2;
144 static char *config_keys[] =
149 static int config_keys_num = 1;
151 typedef struct procstat_entry_s
156 unsigned long num_proc;
157 unsigned long num_lwp;
158 unsigned long vmem_rss;
160 unsigned long vmem_minflt;
161 unsigned long vmem_majflt;
162 unsigned long vmem_minflt_counter;
163 unsigned long vmem_majflt_counter;
165 unsigned long cpu_user;
166 unsigned long cpu_system;
167 unsigned long cpu_user_counter;
168 unsigned long cpu_system_counter;
170 struct procstat_entry_s *next;
173 #define PROCSTAT_NAME_LEN 256
174 typedef struct procstat
176 char name[PROCSTAT_NAME_LEN];
178 unsigned long num_proc;
179 unsigned long num_lwp;
180 unsigned long vmem_rss;
182 unsigned long vmem_minflt_counter;
183 unsigned long vmem_majflt_counter;
185 unsigned long cpu_user_counter;
186 unsigned long cpu_system_counter;
188 struct procstat *next;
189 struct procstat_entry_s *instances;
192 static procstat_t *list_head_g = NULL;
195 static mach_port_t port_host_self;
196 static mach_port_t port_task_self;
198 static processor_set_name_array_t pset_list;
199 static mach_msg_type_number_t pset_list_len;
200 /* #endif HAVE_THREAD_INFO */
203 static long pagesize_g;
204 #endif /* KERNEL_LINUX */
206 static void ps_list_register (const char *name)
211 if ((new = (procstat_t *) malloc (sizeof (procstat_t))) == NULL)
213 memset (new, 0, sizeof (procstat_t));
214 strncpy (new->name, name, PROCSTAT_NAME_LEN);
216 for (ptr = list_head_g; ptr != NULL; ptr = ptr->next)
218 if (strcmp (ptr->name, name) == 0)
220 if (ptr->next == NULL)
230 static procstat_t *ps_list_search (const char *name)
234 for (ptr = list_head_g; ptr != NULL; ptr = ptr->next)
235 if (strcmp (ptr->name, name) == 0)
241 static void ps_list_add (const char *name, procstat_entry_t *entry)
244 procstat_entry_t *pse;
249 if ((ps = ps_list_search (name)) == NULL)
252 for (pse = ps->instances; pse != NULL; pse = pse->next)
253 if ((pse->id == entry->id) || (pse->next == NULL))
256 if ((pse == NULL) || (pse->id != entry->id))
258 procstat_entry_t *new;
260 new = (procstat_entry_t *) malloc (sizeof (procstat_entry_t));
263 memset (new, 0, sizeof (procstat_entry_t));
275 pse->num_proc = entry->num_proc;
276 pse->num_lwp = entry->num_lwp;
277 pse->vmem_rss = entry->vmem_rss;
279 ps->num_proc += pse->num_proc;
280 ps->num_lwp += pse->num_lwp;
281 ps->vmem_rss += pse->vmem_rss;
283 if ((entry->vmem_minflt_counter == 0)
284 && (entry->vmem_majflt_counter == 0))
286 pse->vmem_minflt_counter += entry->vmem_minflt;
287 pse->vmem_minflt = entry->vmem_minflt;
289 pse->vmem_majflt_counter += entry->vmem_majflt;
290 pse->vmem_majflt = entry->vmem_majflt;
294 if (entry->vmem_minflt_counter < pse->vmem_minflt_counter)
296 pse->vmem_minflt = entry->vmem_minflt_counter
297 + (ULONG_MAX - pse->vmem_minflt_counter);
301 pse->vmem_minflt = entry->vmem_minflt_counter - pse->vmem_minflt_counter;
303 pse->vmem_minflt_counter = entry->vmem_minflt_counter;
305 if (entry->vmem_majflt_counter < pse->vmem_majflt_counter)
307 pse->vmem_majflt = entry->vmem_majflt_counter
308 + (ULONG_MAX - pse->vmem_majflt_counter);
312 pse->vmem_majflt = entry->vmem_majflt_counter - pse->vmem_majflt_counter;
314 pse->vmem_majflt_counter = entry->vmem_majflt_counter;
317 ps->vmem_minflt_counter += pse->vmem_minflt;
318 ps->vmem_majflt_counter += pse->vmem_majflt;
320 if ((entry->cpu_user_counter == 0)
321 && (entry->cpu_system_counter == 0))
323 pse->cpu_user_counter += entry->cpu_user;
324 pse->cpu_user = entry->cpu_user;
326 pse->cpu_system_counter += entry->cpu_system;
327 pse->cpu_system = entry->cpu_system;
331 if (entry->cpu_user_counter < pse->cpu_user_counter)
333 pse->cpu_user = entry->cpu_user_counter
334 + (ULONG_MAX - pse->cpu_user_counter);
338 pse->cpu_user = entry->cpu_user_counter - pse->cpu_user_counter;
340 pse->cpu_user_counter = entry->cpu_user_counter;
342 if (entry->cpu_system_counter < pse->cpu_system_counter)
344 pse->cpu_system = entry->cpu_system_counter
345 + (ULONG_MAX - pse->cpu_system_counter);
349 pse->cpu_system = entry->cpu_system_counter - pse->cpu_system_counter;
351 pse->cpu_system_counter = entry->cpu_system_counter;
354 ps->cpu_user_counter += pse->cpu_user;
355 ps->cpu_system_counter += pse->cpu_system;
358 static void ps_list_reset (void)
361 procstat_entry_t *pse;
362 procstat_entry_t *pse_prev;
364 for (ps = list_head_g; ps != NULL; ps = ps->next)
376 DBG ("Removing this procstat entry cause it's too old: "
377 "id = %lu; name = %s;",
380 if (pse_prev == NULL)
382 ps->instances = pse->next;
388 pse_prev->next = pse->next;
390 pse = pse_prev->next;
399 } /* while (pse != NULL) */
400 } /* for (ps = list_head_g; ps != NULL; ps = ps->next) */
403 static int ps_config (char *key, char *value)
405 if (strcasecmp (key, "Process") == 0)
407 ps_list_register (value);
417 static void ps_init (void)
420 kern_return_t status;
422 port_host_self = mach_host_self ();
423 port_task_self = mach_task_self ();
425 if (pset_list != NULL)
427 vm_deallocate (port_task_self,
428 (vm_address_t) pset_list,
429 pset_list_len * sizeof (processor_set_t));
434 if ((status = host_processor_sets (port_host_self,
436 &pset_list_len)) != KERN_SUCCESS)
438 syslog (LOG_ERR, "host_processor_sets failed: %s\n",
439 mach_error_string (status));
444 /* #endif HAVE_THREAD_INFO */
447 pagesize_g = sysconf(_SC_PAGESIZE);
448 DBG ("pagesize_g = %li; CONFIG_HZ = %i;",
449 pagesize_g, CONFIG_HZ);
450 #endif /* KERNEL_LINUX */
455 static void ps_write (char *host, char *inst, char *val)
457 rrd_update_file (host, processes_file, val,
458 processes_ds_def, processes_ds_num);
461 static void ps_rss_write (char *host, char *inst, char *val)
466 status = snprintf (filename, 256, ps_rss_file, inst);
467 if ((status < 1) || (status >= 256))
470 rrd_update_file (host, filename, val, ps_rss_ds_def, ps_rss_ds_num);
473 static void ps_cputime_write (char *host, char *inst, char *val)
478 status = snprintf (filename, 256, ps_cputime_file, inst);
479 if ((status < 1) || (status >= 256))
482 DBG ("host = %s; filename = %s; val = %s;",
483 host, filename, val);
484 rrd_update_file (host, filename, val,
485 ps_cputime_ds_def, ps_cputime_ds_num);
488 static void ps_count_write (char *host, char *inst, char *val)
493 status = snprintf (filename, 256, ps_count_file, inst);
494 if ((status < 1) || (status >= 256))
497 DBG ("host = %s; filename = %s; val = %s;",
498 host, filename, val);
499 rrd_update_file (host, filename, val,
500 ps_count_ds_def, ps_count_ds_num);
503 static void ps_pagefaults_write (char *host, char *inst, char *val)
508 status = snprintf (filename, 256, ps_pagefaults_file, inst);
509 if ((status < 1) || (status >= 256))
512 DBG ("host = %s; filename = %s; val = %s;",
513 host, filename, val);
514 rrd_update_file (host, filename, val,
515 ps_pagefaults_ds_def, ps_pagefaults_ds_num);
518 #if PROCESSES_HAVE_READ
519 static void ps_submit (int running,
528 if (snprintf (buf, BUFSIZE, "%u:%i:%i:%i:%i:%i:%i",
529 (unsigned int) curtime,
530 running, sleeping, zombies, stopped, paging,
534 DBG ("running = %i; sleeping = %i; zombies = %i; stopped = %i; paging = %i; blocked = %i;",
535 running, sleeping, zombies, stopped, paging, blocked);
537 plugin_submit (MODULE_NAME, "-", buf);
540 static void ps_submit_proc_list (procstat_t *ps)
547 snprintf (buffer, 64, "%u:%lu",
548 (unsigned int) curtime,
551 plugin_submit ("ps_rss", ps->name, buffer);
553 snprintf (buffer, 64, "%u:%u:%u",
554 (unsigned int) curtime,
555 /* Make the counter overflow */
556 (unsigned int) (ps->cpu_user_counter & 0xFFFFFFFF),
557 (unsigned int) (ps->cpu_system_counter & 0xFFFFFFFF));
559 plugin_submit ("ps_cputime", ps->name, buffer);
561 snprintf (buffer, 64, "%u:%lu:%lu",
562 (unsigned int) curtime,
563 ps->num_proc, ps->num_lwp);
565 plugin_submit ("ps_count", ps->name, buffer);
567 snprintf (buffer, 64, "%u:%lu:%lu",
568 (unsigned int) curtime,
569 ps->vmem_minflt_counter, ps->vmem_majflt_counter);
571 plugin_submit ("ps_pagefaults", ps->name, buffer);
573 DBG ("name = %s; num_proc = %lu; num_lwp = %lu; vmem_rss = %lu; "
574 "vmem_minflt_counter = %i; vmem_majflt_counter = %i; "
575 "cpu_user_counter = %i; cpu_system_counter = %i;",
576 ps->name, ps->num_proc, ps->num_lwp, ps->vmem_rss,
577 ps->vmem_minflt_counter, ps->vmem_majflt_counter, ps->cpu_user_counter,
578 ps->cpu_system_counter);
583 static int *ps_read_tasks (int pid)
586 int list_size = 1; /* size of allocated space, in elements */
587 int list_len = 0; /* number of currently used elements */
593 snprintf (dirname, 64, "/proc/%i/task", pid);
596 if ((dh = opendir (dirname)) == NULL)
598 syslog (LOG_NOTICE, "processes plugin: Failed to open directory `%s'",
603 while ((ent = readdir (dh)) != NULL)
605 if (!isdigit (ent->d_name[0]))
608 if ((list_len + 1) >= list_size)
611 int new_size = 2 * list_size;
612 /* Comes in sizes: 2, 4, 8, 16, ... */
614 new_ptr = (int *) realloc (list, (size_t) (sizeof (int) * new_size));
619 syslog (LOG_ERR, "processes plugin: "
620 "Failed to allocate more memory.");
625 list_size = new_size;
627 memset (list + list_len, 0, sizeof (int) * (list_size - list_len));
630 list[list_len] = atoi (ent->d_name);
631 if (list[list_len] != 0)
637 assert (list_len < list_size);
638 assert (list[list_len] == 0);
643 int ps_read_process (int pid, procstat_t *ps, char *state)
658 long long unsigned cpu_user_counter;
659 long long unsigned cpu_system_counter;
660 long long unsigned vmem_rss;
662 memset (ps, 0, sizeof (procstat_t));
664 snprintf (filename, 64, "/proc/%i/stat", pid);
667 if ((fh = fopen (filename, "r")) == NULL)
670 if (fgets (buffer, 1024, fh) == NULL)
678 fields_len = strsplit (buffer, fields, 64);
681 DBG ("`%s' has only %i fields..",
682 filename, fields_len);
685 else if (fields_len != 41)
687 DBG ("WARNING: (fields_len = %i) != 41", fields_len);
690 /* copy the name, strip brackets in the process */
691 name_len = strlen (fields[1]) - 2;
692 if ((fields[1][0] != '(') || (fields[1][name_len + 1] != ')'))
694 DBG ("No brackets found in process name: `%s'", fields[1]);
697 fields[1] = fields[1] + 1;
698 fields[1][name_len] = '\0';
699 strncpy (ps->name, fields[1], PROCSTAT_NAME_LEN);
701 ppid = atoi (fields[3]);
703 if ((tasks = ps_read_tasks (pid)) == NULL)
705 /* This happends for zombied, e.g. */
706 DBG ("ps_read_tasks (%i) failed.", pid);
716 for (i = 0; tasks[i] != 0; i++)
723 /* Leave the rest at zero if this is only an LWP */
724 if (ps->num_proc == 0)
726 DBG ("This is only an LWP: pid = %i; name = %s;",
731 cpu_user_counter = atoll (fields[13]);
732 cpu_system_counter = atoll (fields[14]);
733 vmem_rss = atoll (fields[23]);
734 ps->vmem_minflt_counter = atol (fields[9]);
735 ps->vmem_majflt_counter = atol (fields[11]);
737 /* Convert jiffies to useconds */
738 cpu_user_counter = cpu_user_counter * 1000000 / CONFIG_HZ;
739 cpu_system_counter = cpu_system_counter * 1000000 / CONFIG_HZ;
740 vmem_rss = vmem_rss * pagesize_g;
742 ps->cpu_user_counter = (unsigned long) cpu_user_counter;
743 ps->cpu_system_counter = (unsigned long) cpu_system_counter;
744 ps->vmem_rss = (unsigned long) vmem_rss;
746 *state = fields[2][0];
750 } /* int ps_read_process (...) */
751 #endif /* KERNEL_LINUX */
753 static void ps_read (void)
756 kern_return_t status;
759 processor_set_t port_pset_priv;
762 task_array_t task_list;
763 mach_msg_type_number_t task_list_len;
766 thread_act_array_t thread_list;
767 mach_msg_type_number_t thread_list_len;
768 thread_basic_info_data_t thread_data;
769 mach_msg_type_number_t thread_data_len;
778 * The Mach-concept is a little different from the traditional UNIX
779 * concept: All the work is done in threads. Threads are contained in
780 * `tasks'. Therefore, `task status' doesn't make much sense, since
781 * it's actually a `thread status'.
782 * Tasks are assigned to sets of processors, so that's where you go to
785 for (pset = 0; pset < pset_list_len; pset++)
787 if ((status = host_processor_set_priv (port_host_self,
789 &port_pset_priv)) != KERN_SUCCESS)
791 syslog (LOG_ERR, "host_processor_set_priv failed: %s\n",
792 mach_error_string (status));
796 if ((status = processor_set_tasks (port_pset_priv,
798 &task_list_len)) != KERN_SUCCESS)
800 syslog (LOG_ERR, "processor_set_tasks failed: %s\n",
801 mach_error_string (status));
802 mach_port_deallocate (port_task_self, port_pset_priv);
806 for (task = 0; task < task_list_len; task++)
808 status = task_threads (task_list[task], &thread_list,
810 if (status != KERN_SUCCESS)
812 /* Apple's `top' treats this case a zombie. It
813 * makes sense to some extend: A `zombie'
814 * thread is nonsense, since the task/process
817 DBG ("task_threads failed: %s",
818 mach_error_string (status));
819 if (task_list[task] != port_task_self)
820 mach_port_deallocate (port_task_self,
822 continue; /* with next task_list */
825 for (thread = 0; thread < thread_list_len; thread++)
827 thread_data_len = THREAD_BASIC_INFO_COUNT;
828 status = thread_info (thread_list[thread],
830 (thread_info_t) &thread_data,
832 if (status != KERN_SUCCESS)
834 syslog (LOG_ERR, "thread_info failed: %s\n",
835 mach_error_string (status));
836 if (task_list[task] != port_task_self)
837 mach_port_deallocate (port_task_self,
838 thread_list[thread]);
839 continue; /* with next thread_list */
842 switch (thread_data.run_state)
844 case TH_STATE_RUNNING:
847 case TH_STATE_STOPPED:
848 /* What exactly is `halted'? */
849 case TH_STATE_HALTED:
852 case TH_STATE_WAITING:
855 case TH_STATE_UNINTERRUPTIBLE:
858 /* There is no `zombie' case here,
859 * since there are no zombie-threads.
860 * There's only zombie tasks, which are
864 "Unknown thread status: %s",
865 thread_data.run_state);
867 } /* switch (thread_data.run_state) */
869 if (task_list[task] != port_task_self)
871 status = mach_port_deallocate (port_task_self,
872 thread_list[thread]);
873 if (status != KERN_SUCCESS)
874 syslog (LOG_ERR, "mach_port_deallocate failed: %s",
875 mach_error_string (status));
877 } /* for (thread_list) */
879 if ((status = vm_deallocate (port_task_self,
880 (vm_address_t) thread_list,
881 thread_list_len * sizeof (thread_act_t)))
884 syslog (LOG_ERR, "vm_deallocate failed: %s",
885 mach_error_string (status));
890 /* Only deallocate the task port, if it isn't our own.
891 * Don't know what would happen in that case, but this
892 * is what Apple's top does.. ;) */
893 if (task_list[task] != port_task_self)
895 status = mach_port_deallocate (port_task_self,
897 if (status != KERN_SUCCESS)
898 syslog (LOG_ERR, "mach_port_deallocate failed: %s",
899 mach_error_string (status));
901 } /* for (task_list) */
903 if ((status = vm_deallocate (port_task_self,
904 (vm_address_t) task_list,
905 task_list_len * sizeof (task_t))) != KERN_SUCCESS)
907 syslog (LOG_ERR, "vm_deallocate failed: %s",
908 mach_error_string (status));
913 if ((status = mach_port_deallocate (port_task_self, port_pset_priv))
916 syslog (LOG_ERR, "mach_port_deallocate failed: %s",
917 mach_error_string (status));
919 } /* for (pset_list) */
921 ps_submit (running, sleeping, zombies, stopped, -1, blocked);
922 /* #endif HAVE_THREAD_INFO */
938 procstat_entry_t pse;
943 running = sleeping = zombies = stopped = paging = blocked = 0;
946 if ((proc = opendir ("/proc")) == NULL)
948 syslog (LOG_ERR, "Cannot open `/proc': %s", strerror (errno));
952 while ((ent = readdir (proc)) != NULL)
954 if (!isdigit (ent->d_name[0]))
957 if ((pid = atoi (ent->d_name)) < 1)
960 status = ps_read_process (pid, &ps, &state);
963 DBG ("ps_read_process failed: %i", status);
970 pse.num_proc = ps.num_proc;
971 pse.num_lwp = ps.num_lwp;
972 pse.vmem_rss = ps.vmem_rss;
975 pse.vmem_minflt_counter = ps.vmem_minflt_counter;
977 pse.vmem_majflt_counter = ps.vmem_majflt_counter;
980 pse.cpu_user_counter = ps.cpu_user_counter;
982 pse.cpu_system_counter = ps.cpu_system_counter;
986 case 'R': running++; break;
987 case 'S': sleeping++; break;
988 case 'D': blocked++; break;
989 case 'Z': zombies++; break;
990 case 'T': stopped++; break;
991 case 'W': paging++; break;
994 ps_list_add (ps.name, &pse);
999 ps_submit (running, sleeping, zombies, stopped, paging, blocked);
1001 for (ps_ptr = list_head_g; ps_ptr != NULL; ps_ptr = ps_ptr->next)
1002 ps_submit_proc_list (ps_ptr);
1003 #endif /* KERNEL_LINUX */
1006 # define ps_read NULL
1007 #endif /* PROCESSES_HAVE_READ */
1009 void module_register (void)
1011 plugin_register (MODULE_NAME, ps_init, ps_read, ps_write);
1012 plugin_register ("ps_rss", NULL, NULL, ps_rss_write);
1013 plugin_register ("ps_cputime", NULL, NULL, ps_cputime_write);
1014 plugin_register ("ps_count", NULL, NULL, ps_count_write);
1015 plugin_register ("ps_pagefaults", NULL, NULL, ps_pagefaults_write);
1016 cf_register (MODULE_NAME, ps_config, config_keys, config_keys_num);