Last change
on this file since 387 was 337, checked in by coas-nagasima, 6 years ago |
ASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
272 bytes
|
Line | |
---|
1 | #define _GNU_SOURCE
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <sys/sysinfo.h>
|
---|
4 |
|
---|
5 | int getloadavg(double *a, int n)
|
---|
6 | {
|
---|
7 | struct sysinfo si;
|
---|
8 | if (n <= 0) return n ? -1 : 0;
|
---|
9 | sysinfo(&si);
|
---|
10 | if (n > 3) n = 3;
|
---|
11 | for (int i=0; i<n; i++)
|
---|
12 | a[i] = 1.0/(1<<SI_LOAD_SHIFT) * si.loads[i];
|
---|
13 | return n;
|
---|
14 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.