~ubuntu-branches/ubuntu/oneiric/collectd/oneiric

« back to all changes in this revision

Viewing changes to src/cpu.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Harl
  • Date: 2008-06-17 10:35:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080617103551-9d0ym3zejc7agtt3
Tags: 4.4.1-1
* New upstream release.
  - Fixed another issue of the sensors plugin affecting some chip types
    (Closes: #468143).
  - Fixed creation of "vserver" graphs in collection.cgi (Closes: #475120).
  - Fixed a segfault when using libperl 5.10.
  - collectd now ships libiptc itself.
  New plugins:
  - Ascent server statistics: ascent
  - IPMI sensors information: ipmi
  - PowerDNS name server statistics: powerdns
  - incremental parsing of logfiles: tail
  - TeamSpeak2 server statistics: teamspeak2
  - detailed virtual memory statistics: vmem
* Disable "tcpconns" plugin by default (Closes: #478759).
* Reenabled iptables plugin on all architectures (Closes: #473435).
  - Added the plugin to collectd.conf.
  - Added /usr/share/doc/collectd/examples/iptables/.
  - Added build dependency on linux-libc-dev (>= 2.6.25-4) - that version is
    required because of #479899.
* New debconf template translations:
  - gl.po, thanks to Jacobo Tarrio (Closes: #482667).
* Added a work around for #474087 (broken openipmi .pc files) by forcing the
  inclusion of the ipmi plugin and manually specifying the dependencies.
* Updated standards-version to 3.8.0 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
# endif
69
69
#endif /* HAVE_SYSCTLBYNAME */
70
70
 
71
 
#if !PROCESSOR_CPU_LOAD_INFO && !KERNEL_LINUX && !HAVE_LIBKSTAT && !HAVE_SYSCTLBYNAME
 
71
#if HAVE_STATGRAB_H
 
72
# include <statgrab.h>
 
73
#endif
 
74
 
 
75
#if !PROCESSOR_CPU_LOAD_INFO && !KERNEL_LINUX && !HAVE_LIBKSTAT \
 
76
        && !HAVE_SYSCTLBYNAME && !HAVE_LIBSTATGRAB
72
77
# error "No applicable input method."
73
78
#endif
74
79
 
98
103
 
99
104
#elif defined(HAVE_SYSCTLBYNAME)
100
105
static int numcpu;
101
 
#endif /* HAVE_SYSCTLBYNAME */
 
106
/* #endif HAVE_SYSCTLBYNAME */
 
107
 
 
108
#elif defined(HAVE_LIBSTATGRAB)
 
109
/* no variables needed */
 
110
#endif /* HAVE_LIBSTATGRAB */
102
111
 
103
112
static int init (void)
104
113
{
152
161
 
153
162
        if (numcpu != 1)
154
163
                NOTICE ("cpu: Only one processor supported when using `sysctlbyname' (found %i)", numcpu);
155
 
#endif
 
164
/* #endif HAVE_SYSCTLBYNAME */
 
165
 
 
166
#elif defined(HAVE_LIBSTATGRAB)
 
167
        /* nothing to initialize */
 
168
#endif /* HAVE_LIBSTATGRAB */
156
169
 
157
170
        return (0);
158
171
} /* int init */
370
383
        submit (0, "nice", cpuinfo[CP_NICE]);
371
384
        submit (0, "system", cpuinfo[CP_SYS]);
372
385
        submit (0, "idle", cpuinfo[CP_IDLE]);
373
 
#endif
 
386
/* #endif HAVE_SYSCTLBYNAME */
 
387
 
 
388
#elif defined(HAVE_LIBSTATGRAB)
 
389
       sg_cpu_stats *cs;
 
390
       cs = sg_get_cpu_stats ();
 
391
 
 
392
       if (cs == NULL)
 
393
       {
 
394
               ERROR ("cpu plugin: sg_get_cpu_stats failed.");
 
395
               return (-1);
 
396
       }
 
397
 
 
398
       submit (0, "idle",   (counter_t) cs->idle);
 
399
       submit (0, "nice",   (counter_t) cs->nice);
 
400
       submit (0, "swap",   (counter_t) cs->swap);
 
401
       submit (0, "system", (counter_t) cs->kernel);
 
402
       submit (0, "user",   (counter_t) cs->user);
 
403
       submit (0, "wait",   (counter_t) cs->iowait);
 
404
#endif /* HAVE_LIBSTATGRAB */
374
405
 
375
406
        return (0);
376
407
}