1

I m trying to figure out getting load average of iOS system over time intervals of 1,5 and 15 minutes. I have found the usage example regarding it which is as below :

double la[3];
getloadavg(la, 3);
NSLog(@"Load average : %f - %f - %f", la[0], la[1], la[2]);

What I don't understand here is the significance of 3.Should I pass 1, 5, 15 to getloadavg() function, or this is the correct method? Any help is appreciated.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
iCodes
  • 1,382
  • 3
  • 21
  • 47
  • 1
    If it is like the version of this function on Linux, 3 is the number of samples to return, it is limited to at most three and you get the 1, 5, and 15 minutes numbers: https://linux.die.net/man/3/getloadavg – Thilo May 09 '17 at 11:52
  • So the usage is correct i guess – iCodes May 09 '17 at 11:54
  • I'd say yes, it's correct. This is verified by passing '2' and it returns averages for 1 and 5 minutes, but a -1 for 15 minutes. – norders May 09 '17 at 11:57
  • Thanks @ norders – iCodes May 09 '17 at 12:29

1 Answers1

0

I'd say yes, it's correct. This is verified by passing '2' and it returns averages for 1 and 5 minutes, but a -1 for 15 minutes.

norders
  • 1,160
  • 9
  • 13