Sha256: af9d430774419f0b98238a69ad8b2642b4e399497affac6f581e29bf48cb6020
Contents?: true
Size: 759 Bytes
Versions: 11
Compression:
Stored size: 759 Bytes
Contents
#include <stdio.h> #include <stdlib.h> #define LUA_LIB #include "lua.h" #include "lauxlib.h" /*https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-loadavg.html Gives load average in regard to both the CPU and IO over time, as well as additional data used by uptime and other commands. */ /* Immunio Lua bindings */ static int lua_loadavg(lua_State *L) { char c[100]; FILE *fp; if ((fp=fopen("/proc/loadavg","r"))==NULL) { return 0; } if (fgets(c, 100, fp) != NULL) { lua_pushstring(L, c); } fclose(fp); return 1; } static const luaL_Reg libloadavg[] = { {"loadavg", lua_loadavg}, {NULL, NULL} }; int luaopen_loadavg(lua_State *L) { // luaL_checkversion(L); luaL_register(L, "perf", libloadavg); return 1; }
Version data entries
11 entries across 11 versions & 1 rubygems