+
+#if defined(HAVE_PERFSTAT) /* {{{ */
+ cdtime_t now = cdtime ();
+ perfstat_cpu_total_t cputotal = { 0 };
+
+ if (!perfstat_cpu_total(NULL, &cputotal, sizeof(cputotal), 1)) {
+ char errbuf[1024];
+ WARNING ("cpu plugin: perfstat_cpu_total: %s",
+ sstrerror (errno, errbuf, sizeof (errbuf)));
+ return;
+ }
+
+ /* Reset COLLECTD_CPU_STATE_ACTIVE */
+ sum_by_state[COLLECTD_CPU_STATE_ACTIVE] = NAN;
+
+ /* Physical Processor Utilization */
+ total_rate(sum_by_state, COLLECTD_CPU_STATE_IDLE, (derive_t) cputotal.pidle, &total_conv[TOTAL_IDLE], now);
+ total_rate(sum_by_state, COLLECTD_CPU_STATE_USER, (derive_t) cputotal.puser, &total_conv[TOTAL_USER], now);
+ total_rate(sum_by_state, COLLECTD_CPU_STATE_SYSTEM, (derive_t) cputotal.psys , &total_conv[TOTAL_SYS], now);
+ total_rate(sum_by_state, COLLECTD_CPU_STATE_WAIT, (derive_t) cputotal.pwait, &total_conv[TOTAL_WAIT], now);
+#endif /* }}} HAVE_PERFSTAT */