Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: fusl/src/legacy/getloadavg.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #define _GNU_SOURCE 1 #define _GNU_SOURCE
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <sys/sysinfo.h> 3 #include <sys/sysinfo.h>
4 4
5 int getloadavg(double *a, int n) 5 int getloadavg(double* a, int n) {
6 { 6 struct sysinfo si;
7 » struct sysinfo si; 7 if (n <= 0)
8 » if (n <= 0) return n ? -1 : 0; 8 return n ? -1 : 0;
9 » sysinfo(&si); 9 sysinfo(&si);
10 » if (n > 3) n = 3; 10 if (n > 3)
11 » for (int i=0; i<n; i++) 11 n = 3;
12 » » a[i] = 1.0/(1<<SI_LOAD_SHIFT) * si.loads[i]; 12 for (int i = 0; i < n; i++)
13 » return n; 13 a[i] = 1.0 / (1 << SI_LOAD_SHIFT) * si.loads[i];
14 return n;
14 } 15 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698