SYSMON 1.3: better UI, added Rus translation

git-svn-id: svn://kolibrios.org@8277 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-11-29 00:37:47 +00:00
parent 5d644b9d4f
commit 270aed5ffa
6 changed files with 322 additions and 371 deletions

View File

@ -1,5 +1,9 @@
@del lang.h--
@echo #define LANG_ENG 1 >lang.h--
@del sysmon
@c-- sysmon.c
@rename sysmon.com sysmon
@del warning.txt
@del lang.h--
@pause

View File

@ -0,0 +1,9 @@
@del lang.h--
@echo #define LANG_RUS 1 >lang.h--
@del sysmon
@c-- sysmon.c
@rename sysmon.com sysmon
@del warning.txt
@del lang.h--
@pause

View File

@ -1,96 +0,0 @@
//===================================================//
// //
// DATA //
// //
//===================================================//
sensor cpu;
sensor ram;
//===================================================//
// //
// CODE //
// //
//===================================================//
void DrawIconWithText(dword _x, _y, _icon, _title)
{
DrawIcon16(_x, _y, sc.work, _icon);
DrawBar(_x+ICONGAP, _y, WIN_CONTENT_W - ICONGAP - _x, 20, sc.work);
WriteText(_x+ICONGAP, _y, 0x90, sc.work_text, _title);
}
void CPUnRAM__Main()
{
dword cpu_frequency = GetCpuFrequency()/1000;
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON);
goto _GENERAL_REDRAW_2;
loop()
{
WaitEventTimeout(25);
switch(EAX & 0xFF)
{
case evButton: Sysmon__ButtonEvent(); break;
case evKey: Sysmon__KeyEvent(); break;
case evReDraw:
_GENERAL_REDRAW_2:
Sysmon__DefineAndDrawWindow();
cpu.set_size(WIN_PAD, WIN_CONTENT_Y+25, WIN_CONTENT_W, 100);
ram.set_size(WIN_PAD, WIN_CONTENT_Y+170, WIN_CONTENT_W, 23);
default:
MonitorCpu();
MonitorRam();
}
}
}
dword GetCpuLoad(dword max_h)
{
dword idle;
dword CPU_SEC = GetCpuFrequency() >> 20 + 1;
dword IDLE_SEC = GetCpuIdleCount() >> 20 * max_h;
EAX = IDLE_SEC;
EBX = CPU_SEC;
$cdq
$div ebx
idle = EAX;
return max_h - idle;
}
int pos=0;
void MonitorCpu()
{
static dword cpu_stack[1980*3];
int i;
if (!cpu.w) return;
cpu_stack[pos] = GetCpuLoad(cpu.h);
if (cpu_stack[pos]<=2) || (cpu_stack[pos]>cpu.h) cpu_stack[pos]=2;
sprintf(#param, "CPU load %i%%", cpu_stack[pos]);
DrawIconWithText(WIN_PAD, cpu.y - 25, 48, #param);
for (i=0; i<WIN_CONTENT_W; i+=2) {
DrawBar(i+cpu.x, cpu.y, 1, cpu.h-cpu_stack[i], PROGRESS_BG);
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, 1, cpu_stack[i], LOAD_CPU);
DrawBar(i+1+cpu.x, cpu.y, 1, cpu.h, PROGRESS_BG);
}
pos++;
if (pos>=WIN_CONTENT_W) {
pos = WIN_CONTENT_W-1;
for (i=0; i<pos; i++) {
cpu_stack[i] = cpu_stack[i+1];
}
}
}
void MonitorRam()
{
ram.draw_progress(GetFreeRAM()*ram.w/GetTotalRAM());
sprintf(#param, "RAM usage: %i Mb free of %i Mb", GetFreeRAM()/1024, GetTotalRAM()/1024);
DrawIconWithText(WIN_PAD, ram.y - 25, 51, #param);
}

View File

@ -1,72 +0,0 @@
void Drives__Main()
{
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON);
goto _GENERAL_REDRAW_1;
loop()
{
WaitEventTimeout(500);
switch(EAX & 0xFF)
{
case evButton: Sysmon__ButtonEvent(); break;
case evKey: Sysmon__KeyEvent(); break;
case evReDraw:
_GENERAL_REDRAW_1:
Sysmon__DefineAndDrawWindow();
WriteText(WIN_PAD, WIN_CONTENT_Y+25, 0x90, sc.work, "Update period: 5 seconds");
default:
MonitorRd();
MonitorTmp();
}
}
}
void MonitorRd()
{
sensor rd;
dword rdempty = malloc(1440*1024);
rd.set_size(WIN_PAD, WIN_CONTENT_Y+25, WIN_CONTENT_W, 23);
CreateFile(0, 1440*1024, rdempty, "/rd/1/rdempty");
free(rdempty);
file_size stdcall ("/rd/1/rdempty");
rdempty = EBX / 1024;
DeleteFile("/rd/1/rdempty");
sprintf(#param, "System disk usage: %i Kb free of 1440 Mb", rdempty);
DrawIconWithText(WIN_PAD, rd.y - 25, 5, #param);
rd.draw_progress(rdempty * rd.w / 1440);
}
dword GetTmpDiskFreeSpace(int _id)
{
DIR_SIZE dir_size;
sprintf(#param, "/tmp%i/1", _id);
dir_size.get(#param);
dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size
dir_size.bytes /= 1024*1024; //convert to MiB
return dir_size.bytes;
}
void MonitorTmp()
{
char text_status[64];
int i, yy=WIN_CONTENT_Y+95;
dword tmp_size[10];
dword free_space;
sensor tmp;
for (i=0; i<=9; i++)
{
file_size stdcall ( sprintf(#param, "/tmp%i/1", i) );
tmp_size[i] = EBX / 1024 / 1024;
if (EBX) {
free_space = tmp_size[i] - GetTmpDiskFreeSpace(i);
sprintf(#text_status, "TMP%i usage: %i Mb free of %i Mb", i, free_space, tmp_size[i]);
tmp.set_size(WIN_PAD, yy, WIN_CONTENT_W, 23);
tmp.draw_progress(free_space * WIN_CONTENT_W / tmp_size[i]);
DrawIconWithText(WIN_PAD, tmp.y - 25, 50, #text_status);
yy += 65;
}
}
}

View File

@ -1,150 +0,0 @@
//===================================================//
// //
// DATA //
// //
//===================================================//
#define T_WINDOW_TITLE "Process Manager"
#define T_SHOW_SYSTEM_PROCESSES "Show system"
#define T_DETAILS "Details"
#define T_END_PROCESS "End process"
#define BOTPANEL_H 36
enum {
BTN_ID_SHOW_SYSTEM_PROCESSES=200,
BTN_ID_KILL_PROCESS,
BTN_ID_SHOW_PROCESS_INFO
};
int current_process_id = 0;
unsigned maxcpu;
int proc_list[256];
checkbox show_system = { T_SHOW_SYSTEM_PROCESSES, false };
//===================================================//
// //
// CODE //
// //
//===================================================//
void Processes__Main()
{
int btn;
maxcpu = GetCpuFrequency();
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
goto _PROCESS_REDRAW_3;
loop()
{
WaitEventTimeout(50);
switch(EAX & 0xFF)
{
case evMouse:
SelectList_ProcessMouse();
break;
case evKey:
Sysmon__KeyEvent();
if (key_scancode == SCAN_CODE_DEL) EventKillCurrentProcess();
if (select_list.ProcessKey(key_scancode)) SelectList_LineChanged();
break;
case evButton:
btn = Sysmon__ButtonEvent();
if (show_system.click(btn)) {
SelectList_LineChanged();
}
if (BTN_ID_KILL_PROCESS == btn) {
EventKillCurrentProcess();
}
if (BTN_ID_SHOW_PROCESS_INFO == btn) {
io.run("/sys/tinfo", itoa(GetProcessSlot(current_process_id)));
}
break;
case evReDraw:
_PROCESS_REDRAW_3:
if (!Sysmon__DefineAndDrawWindow()) break;
SelectList_Init(WIN_PAD, WIN_CONTENT_Y,
WIN_CONTENT_W-scroll1.size_x,
WIN_CONTENT_H-BOTPANEL_H-WIN_CONTENT_Y, false);
SelectList_DrawBorder();
//DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, 4, sc.work);
DrawBar(select_list.x-2, select_list.y+select_list.h+2,
select_list.w+scroll1.size_x+4, BOTPANEL_H, sc.work);
DrawCaptButton(Form.cwidth-110-WIN_PAD,
select_list.y+select_list.h+5,
110,25,BTN_ID_KILL_PROCESS,0xF38181, 0xFFFfff, T_END_PROCESS);
DrawCaptButton(Form.cwidth-230-WIN_PAD,
select_list.y+select_list.h+5,
110,25,BTN_ID_SHOW_PROCESS_INFO,
sc.button, sc.button_text, T_DETAILS);
show_system.draw(select_list.x + 3, select_list.y+select_list.h+10);
default:
SelectList_LineChanged();
}
}
}
void EventKillCurrentProcess()
{
KillProcess(current_process_id);
pause(10);
SelectList_LineChanged();
}
void Processes__GetProcessList()
{
int i, j;
proc_info Process;
select_list.count=0;
for (i=0; i<MAX_PROCESS_COUNT; i++)
{
GetProcessInfo(#Process, i);
if (Process.name)
{
for (j=0; j<11; j++) if (Process.name[j]!=' ') {
if (show_system.checked==false) {
//do not show system process
if (Process.name[0]=='@') break;
if (!strcmp(#Process.name, "IDLE")) break;
if (!strcmp(#Process.name, "OS")) break;
}
proc_list[select_list.count] = i;
select_list.count++;
break;
}
}
}
}
void SelectList_DrawLine(dword i)
{
int posy;
char cpu_use[16];
dword bg_color;
proc_info Process;
GetProcessInfo(#Process, proc_list[i+select_list.first]);
posy = i *select_list.item_h + select_list.y;
if (i % 2) bg_color = 0xFFFfff; else bg_color = 0xF0F0F0;
if (i+select_list.first == select_list.cur_y) {
current_process_id = Process.ID;
bg_color = 0x67CCEB;
}
DrawBar(select_list.x, posy, select_list.w, select_list.item_h, bg_color);
WriteText(select_list.x+005, posy+select_list.text_y, select_list.font_type, 0, #Process.name);
WriteText(select_list.w/10*5+select_list.x, posy+select_list.text_y, select_list.font_type, 0x444444, ConvertSizeToKb(Process.use_memory));
sprintf(#cpu_use, "%i %%", Process.use_cpu*100/maxcpu);
if (maxcpu) WriteText(select_list.w/10*8+select_list.x - calc(strlen(#cpu_use)-4*8),
posy+select_list.text_y, select_list.font_type, 0x444444, #cpu_use);
}
void SelectList_LineChanged()
{
Processes__GetProcessList();
SelectList_Draw();
}

View File

@ -1,11 +1,15 @@
/*
* System Monitor
* version 1.0
* version 1.3
* Author: Leency
*/
#define MEMSIZE 4096*30
#ifndef AUTOBUILD
#include "lang.h--"
#endif
//===================================================//
// //
// LIB //
@ -27,81 +31,333 @@
//===================================================//
// //
// DATA //
// CONST //
// //
//===================================================//
#define WIN_PAD 20 //Window padding
#define WIN_CONTENT_X WIN_PAD
#define WIN_CONTENT_Y TAB_HEIGHT+WIN_PAD+20
#define WIN_CONTENT_W 400
#define WIN_CONTENT_H 465
#define GAP 16 //Window padding
#define WIN_CONTENT_X GAP
#define WIN_CONTENT_Y GAP+15
#define PROCESS_LIST_W 260
#define RIGHT_X PROCESS_LIST_W + GAP + GAP + 22
#define ICONGAP 26
#define BASE_TAB_BUTTON_ID 10
proc_info Form;
#define BOTPANEL_H 36
#ifdef LANG_RUS
#define T_CPU_AND_RAM "<22>à®æ¥áá®à ¨ Ž‡“"
#define T_DRIVES "„¨áª¨"
#define T_PROCESSES "<22>à®æ¥ááë"
#define T_APP_TITLE "System Monitor"
#define T_CPU_AND_RAM "<22>à®æ¥áá®à ¨ Ž‡“"
#define T_DRIVES "„¨áª¨"
#define T_PROCESSES "<22>à®æ¥ááë"
#define T_APP_TITLE "‘¨á⥬­ë© ¬®­¨â®à"
#define T_SHOW_SYSTEM "‘¨á⥬­ë¥"
#define T_DETAILS "<22>®¤à®¡­¥¥"
#define T_PROC_KILL "‘­ïâì § ¤ çã"
#define T_PROC_INFO "ˆ­ä®"
#define T_PROC_HEADER "<22>à®æ¥áá Ž‡“ Š¡ <> %"
#define T_CPU_LOAD "‡ £à㧪  ¯à®æ¥áá®à  %i%% "
#define T_RAM_USAGE "<22> ¬ïâì Ž‡“: %i Œ¡ ᢮¡®¤­® ¨§ %i Œ¡"
#define T_RD_USAGE "‘¨á⥬­ë© ¤¨áª: %i Š¡ ᢮¡®¤­® ¨§ 1.4 Œ¡"
#define T_TMP_USAGE "TMP%i ¤¨áª: %i Œ¡ ᢮¡®¤­® ¨§ %i Œ¡"
#else
#define T_CPU_AND_RAM "CPU & RAM"
#define T_DRIVES "Drives"
#define T_PROCESSES "Processes"
#define T_APP_TITLE "System Monitor"
#define T_CPU_AND_RAM "CPU & RAM"
#define T_DRIVES "Drives"
#define T_PROCESSES "Processes"
#define T_APP_TITLE "System Monitor"
#define T_SHOW_SYSTEM "System"
#define T_DETAILS "Details"
#define T_PROC_KILL "Terminate"
#define T_PROC_INFO "Info"
#define T_PROC_HEADER "Process RAM Kb CPU %"
#define T_CPU_LOAD "CPU load %i%% "
#define T_RAM_USAGE "RAM usage: %i Mb free of %i Mb"
#define T_RD_USAGE "System disk usage: %i Kb free of 1.4 Mb"
#define T_TMP_USAGE "TMP%i usage: %i Mb free of %i Mb"
#endif
_tabs tabs = { 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, BASE_TAB_BUTTON_ID };
enum {
BTN_ID_SHOW_SYSTEM_PROCESSES=200,
BTN_ID_PROC_KILL,
BTN_ID_PROC_INFO,
BTN_ID_MENU
};
//===================================================//
// //
// GENERAL EVENTS //
// VARS //
// //
//===================================================//
int Sysmon__DefineAndDrawWindow()
{
dword butx;
sc.get();
DefineAndDrawWindow(screen.width - WIN_CONTENT_H - 200, 100, WIN_CONTENT_W + WIN_PAD + WIN_PAD +9,
WIN_CONTENT_H + TAB_HEIGHT + skin_height + 4, 0x34, sc.work, T_APP_TITLE,0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return false;
//if (Form.width < 300) { MoveSize(OLD,OLD,300,OLD); break; }
//if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
tabs.draw();
return true;
}
int current_process_id = 0;
int proc_list[256];
int Sysmon__ButtonEvent()
{
int bid = GetButtonID();
if (1==bid) ExitProcess();
tabs.click();
return bid;
}
checkbox show_system = { T_SHOW_SYSTEM, false };
void Sysmon__KeyEvent()
{
GetKeys();
if (key_scancode == SCAN_CODE_ESC) ExitProcess();
}
sensor cpu;
sensor ram;
sensor rd;
sensor tmp;
#include "cpu_ram.h"
#include "drives.h"
#include "process.h"
proc_info Form;
void main()
int right_w;
//===================================================//
// //
// CODE //
// //
//===================================================//
void load_lib()
{
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
}
void main()
{
int btn;
//dword cpu_frequency = GetCpuFrequency()/1000;
load_lib();
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
loop() switch(@WaitEventTimeout(120))
{
case evMouse:
SelectList_ProcessMouse();
break;
case evKey:
GetKeys();
if (key_scancode == SCAN_CODE_ESC) ExitProcess();
if (key_scancode == SCAN_CODE_DEL) EventKillCurrentProcess();
if (select_list.ProcessKey(key_scancode)) SelectList_LineChanged();
break;
case evButton:
btn = GetButtonID();
if (1==btn) ExitProcess();
if (show_system.click(btn)) {
SelectList_LineChanged();
}
if (BTN_ID_PROC_KILL == btn) {
EventKillCurrentProcess();
}
if (BTN_ID_PROC_INFO == btn) {
io.run("/sys/tinfo", itoa(GetProcessSlot(current_process_id)));
}
break;
case evReDraw:
sc.get();
DefineAndDrawWindow(screen.width/2 - 350, 100, 700, 490, 0x33, sc.work, T_APP_TITLE,0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
if (Form.width < RIGHT_X+370) { MoveSize(OLD,OLD,RIGHT_X+370,OLD); break; }
if (Form.height < 420) { MoveSize(OLD,OLD,OLD,420); break; }
right_w = Form.cwidth - RIGHT_X - GAP;
right_w &= ~1; // make sure the number is even
WriteText(GAP+5, WIN_CONTENT_Y-20, 0x90, sc.work_text, T_PROC_HEADER);
//bool burger_active = false;
//if (menu_id == OPEN_FILE) burger_active = true;
//DrawTopPanelButton(BTN_ID_MENU, Form.cwidth-GAP-3, GAP, -1, burger_active);
SelectList_Init(GAP, WIN_CONTENT_Y, PROCESS_LIST_W,
Form.cheight-BOTPANEL_H-WIN_CONTENT_Y, false);
SelectList_DrawBorder();
DrawBar(select_list.x-2, select_list.y+select_list.h+2,
select_list.w+scroll1.size_x+4, BOTPANEL_H, sc.work);
DrawCaptButton(PROCESS_LIST_W+GAP-110+18, select_list.y+select_list.h+5,
110,23,BTN_ID_PROC_KILL,0xF38181, 0xFFFfff, T_PROC_KILL);
DrawCaptButton(PROCESS_LIST_W+GAP-165+18, select_list.y+select_list.h+5,
46,23,BTN_ID_PROC_INFO,sc.button, sc.button_text, T_PROC_INFO);
show_system.draw(GAP-1, select_list.y+select_list.h+10);
//WriteText(RIGHT_X, WIN_CONTENT_Y+25, 0x90, sc.work, "Update period: 5 seconds");
cpu.set_size(RIGHT_X, WIN_CONTENT_Y+25, right_w, 100);
ram.set_size(RIGHT_X, WIN_CONTENT_Y+170, right_w, 23);
rd.set_size(RIGHT_X, WIN_CONTENT_Y+240, right_w, 23);
default:
SelectList_LineChanged();
MonitorCpu();
MonitorRam();
MonitorRd();
MonitorTmp();
}
}
void EventKillCurrentProcess()
{
KillProcess(current_process_id);
pause(10);
SelectList_LineChanged();
}
void Processes__GetProcessList()
{
int i, j;
proc_info Process;
select_list.count=0;
for (i=0; i<MAX_PROCESS_COUNT; i++)
{
GetProcessInfo(#Process, i);
if (Process.name)
{
for (j=0; j<11; j++) if (Process.name[j]!=' ') {
if (show_system.checked==false) {
//do not show system process
if (Process.name[0]=='@') break;
if (!strcmp(#Process.name, "IDLE")) break;
if (!strcmp(#Process.name, "OS")) break;
}
proc_list[select_list.count] = i;
select_list.count++;
break;
}
}
}
}
void SelectList_DrawLine(dword i)
{
int posy;
char cpu_use[16];
char mem_use[16];
dword bg_color;
proc_info Process;
static unsigned maxcpu;
if (!maxcpu) maxcpu = GetCpuFrequency();
GetProcessInfo(#Process, proc_list[i+select_list.first]);
posy = i *select_list.item_h + select_list.y;
if (i % 2) bg_color = 0xFFFfff; else bg_color = 0xF0F0F0;
if (i+select_list.first == select_list.cur_y) {
current_process_id = Process.ID;
bg_color = 0x67CCEB;
}
DrawBar(select_list.x, posy, select_list.w, select_list.item_h, bg_color);
WriteText(GAP+5, posy+select_list.text_y, 0x90, 0, #Process.name);
if (Process.use_memory < 3670016000) {
sprintf(#mem_use, "%i", Process.use_memory/1024);
WriteText(GAP+123 - calc(strlen(#mem_use)-6*8), posy+select_list.text_y, 0x90, 0x444444, #mem_use);
}
sprintf(#cpu_use, "%i", Process.use_cpu*100/maxcpu);
if (maxcpu) WriteText(GAP+203 - calc(strlen(#cpu_use)-4*8),
posy+select_list.text_y, 0x90, 0x444444, #cpu_use);
}
void SelectList_LineChanged()
{
Processes__GetProcessList();
SelectList_Draw();
}
void MonitorRd()
{
dword rdempty = malloc(1440*1024);
CreateFile(0, 1440*1024, rdempty, "/rd/1/rdempty");
free(rdempty);
file_size stdcall ("/rd/1/rdempty");
rdempty = EBX / 1024;
DeleteFile("/rd/1/rdempty");
sprintf(#param, T_RD_USAGE, rdempty);
DrawIconWithText(RIGHT_X, rd.y - 25, 5, #param);
rd.draw_progress(rdempty * rd.w / 1440);
}
dword GetTmpDiskFreeSpace(int _id)
{
DIR_SIZE dir_size;
sprintf(#param, "/tmp%i/1", _id);
dir_size.get(#param);
dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size
dir_size.bytes /= 1024*1024; //convert to MiB
return dir_size.bytes;
}
void MonitorTmp()
{
char text_status[64];
int i, yy=WIN_CONTENT_Y+300;
dword tmp_size[10];
dword free_space;
for (i=0; i<=9; i++)
{
file_size stdcall ( sprintf(#param, "/tmp%i/1", i) );
tmp_size[i] = EBX / 1024 / 1024;
if (EBX) {
free_space = tmp_size[i] - GetTmpDiskFreeSpace(i);
sprintf(#text_status, T_TMP_USAGE, i, free_space, tmp_size[i]);
tmp.set_size(RIGHT_X, yy, right_w, 23);
tmp.draw_progress(free_space * right_w / tmp_size[i]);
DrawIconWithText(RIGHT_X, tmp.y - 25, 50, #text_status);
yy += 65;
}
}
}
void DrawIconWithText(dword _x, _y, _icon, _title)
{
DrawIcon16(_x, _y, sc.work, _icon);
WriteTextWithBg(_x+ICONGAP, _y, 0xD0, sc.work_text, _title, sc.work);
}
dword GetCpuLoad(dword max_h)
{
dword idle;
dword CPU_SEC = GetCpuFrequency() >> 20 + 1;
dword IDLE_SEC = GetCpuIdleCount() >> 20 * max_h;
EAX = IDLE_SEC;
EBX = CPU_SEC;
$cdq
$div ebx
idle = EAX;
return max_h - idle;
}
int pos=0;
void MonitorCpu()
{
static dword cpu_stack[1980*3];
int i;
if (!cpu.w) return;
cpu_stack[pos] = GetCpuLoad(cpu.h);
if (cpu_stack[pos]<=2) || (cpu_stack[pos]>cpu.h) cpu_stack[pos]=2;
sprintf(#param, T_CPU_LOAD, cpu_stack[pos]);
DrawIconWithText(RIGHT_X, cpu.y - 25, 48, #param);
for (i=0; i<right_w; i+=2) {
DrawBar(i+cpu.x, cpu.y, 1, cpu.h-cpu_stack[i], PROGRESS_BG);
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, 1, cpu_stack[i], LOAD_CPU);
DrawBar(i+1+cpu.x, cpu.y, 1, cpu.h, PROGRESS_BG);
}
pos++;
if (pos>=right_w) {
pos = right_w-1;
for (i=0; i<pos; i++) {
cpu_stack[i] = cpu_stack[i+1];
}
}
}
void MonitorRam()
{
ram.draw_progress(GetFreeRAM()*ram.w/GetTotalRAM());
sprintf(#param, T_RAM_USAGE, GetFreeRAM()/1024, GetTotalRAM()/1024);
DrawIconWithText(RIGHT_X, ram.y - 25, 51, #param);
}
tabs.add(T_CPU_AND_RAM, #CPUnRAM__Main);
tabs.add(T_DRIVES, #Drives__Main);
tabs.add(T_PROCESSES, #Processes__Main);
CPUnRAM__Main();
}