collectd/collectd — pull request #344 by vbartoni (2013-06-07 10:40:54+00:00)
Title: Load plugin: Reporting load relative to number of CPU cores

Hi,
The changes in this pull request allow options for reporting load:
* ReportAbsoluteLoad - like it was beofre (uptime style)
* ReportRelativeLoad - load divided by number of cores

Relative load is usefull in environments where collects server, or e.g. another party using rrd data from collectd server, would not know how many cores are on the collectd clients.

The patch also introduces a tiny refactoring which should help the maintenance effort.

There is also one bug fix:
```c
@@ -95,6 +155,7 @@ static int load_read (void)
char errbuf[1024];
WARNING ("load: fopen: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
+ fclose (loadavg);
return (-1);
}
```
Worth commenting is this:
```
+ int cores = sysconf(_SC_NPROCESSORS_ONLN);
```
sysconf() is from glibc. More portable would be to explicitly read /proc/cpuinfo, but I was a bit in hurry.