This currently very small project was made to wrap some Gnu libc functions to the dotnet-world.
$ dotnet add package RL.Gnu.LibCThis currently very small project was made to wrap some Gnu libc functions to the dotnet-world. This library doesn't work on Windows.
to get the load averages:
using System;
using RL.Gnu;
namespace Console
{
class Program
{
static void Main(string[] args)
{
// there are different ways to retrieve the load averages.
// 1. the classical c-way.
double[] loadavg;
var samples = LibC.getloadavg(out loadavg, 3);
if (samples != -1) {
Console.WriteLine("{0} {1} {2}", loadavg[0], loadavg[1], loadavg[2]);
}
// 2. the dotnet-like-way.
loadavg = LibC.GetLoadAverages();
Console.WriteLine("{0} {1} {2}", loadavg[0], loadavg[1], loadavg[2]);
}
}
}