//////////////// public CompletionStatHUD( Vector2 pos, Vector2 dim, string title, Func <bool> enabler, StatGetter stat) : base("Stat_" + title, pos, dim, enabler) { this.TitleText = title; this.Stat = stat; }
private void RefreshCpu() { var statGetter = new StatGetter(Device, executor); var image1 = statGetter.GetTotal(); var image2 = statGetter.GetTotal(); int s1 = image1.Guset + image1.Idle + image1.Iowait + image1.Irq + image1.Nice + image1.SoftIrq + image1.StealStolen + image1.System + image1.User; int s2 = image2.Guset + image2.Idle + image2.Iowait + image2.Irq + image2.Nice + image2.SoftIrq + image2.StealStolen + image2.System + image2.User; int total = s2 - s1; int idle = image2.Idle - image1.Idle; CpuUsed = 100 * (total - idle) / total; CpuCoreNumber = statGetter.GetCpuStats().Count(); }