/* * System Monitor * version 0.7 * Author: Leency */ #define MEMSIZE 4096*10 #include "../lib/io.h" #include "../lib/gui.h" #include "../lib/obj/libio.h" #include "../lib/obj/libimg.h" #include "../lib/obj/libini.h" //===================================================// // // // SENSOR // // // //===================================================// #define MIN_PB_BLOCK_W 19 #define LOAD_BG 0xFFFfff #define LOAD_ACTIVE 0x4C52FF struct sensor { int x,y,w,h; void set_size(); void draw_wrapper(); void draw_progress(); }; void sensor::set_size(dword _x, _y, _w, _h) { x=_x+2; y=_y; w=_w; h=_h; } void sensor::draw_wrapper() { DrawRectangle(x-1, y-1, w+1, h+1, system.color.work_graph); DrawRectangle3D(x-2, y-2, w+3, h+3, system.color.work_dark, system.color.work_light); } void sensor::draw_progress(dword progress_w, active_value, bg_value, mesure) { if (progress_w < MIN_PB_BLOCK_W) progress_w = MIN_PB_BLOCK_W; if (progress_w > w-MIN_PB_BLOCK_W) progress_w = w-MIN_PB_BLOCK_W; DrawBar(x, y, w-progress_w, h, LOAD_ACTIVE); sprintf(#param, "%i%s", active_value, mesure); WriteText(w-progress_w- calc(strlen(#param)*8) /2 + x, h/2-7+y, 0x90, LOAD_BG, #param); DrawBar(x+w-progress_w, y, progress_w, h, LOAD_BG); sprintf(#param, "%i%s", bg_value, mesure); WriteText(-progress_w - calc(strlen(#param)*8)/2 + w+x, h/2-7+y, 0x90, LOAD_ACTIVE, #param); } //===================================================// // // // GetSizeDir // // // //===================================================// BDVK file_info_dirsize; dword dir_count; dword file_count; dword size_dir; void GetDirSizeAndCountFiles(dword way) { dir_count=0; file_count=0; size_dir=0; GetDirSizeAndCountFiles_loop(way); } void GetDirSizeAndCountFiles_loop(dword way) { dword dirbuf, fcount, i, filename; dword cur_file; if (dir_exists(way)) { cur_file = malloc(4096); // In the process of recursive descent, memory must be allocated dynamically, // because the static memory -> was a bug !!! But unfortunately pass away to sacrifice speed. GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL); for (i=0; i> 20 + 1; dword IDLE_SEC = GetCpuIdleCount() >> 20 * max_h; EAX = IDLE_SEC; EBX = CPU_SEC; $cdq $div ebx idle = EAX; return max_h - idle; } //===================================================// // // // MONITORS // // // //===================================================// int pos=0; void MonitorCpu() { 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; DrawBar(cpu.x+cpu.w-30, cpu.y-25, 30, 20, system.color.work); sprintf(#param, "%i%%", cpu_stack[pos]); WriteText(cpu.x+cpu.w-calc(strlen(#param)*8), cpu.y-25, 0x90, system.color.work_text, #param); for (i=0; i=CPU_STACK) { pos = CPU_STACK-1; for (i=0; i