Получем использование RAM на Си
This commit is contained in:
parent
1cb337c7b1
commit
c844ea9749
@ -3,7 +3,7 @@
|
||||
## Other
|
||||
|
||||
- [seconds_to_minutes_and_hours.c](seconds_to_minutes_and_hours.c) - Преобразование секунд в минуты и часы
|
||||
|
||||
- [get_ram_usage.c](get_ram_usage.c) - Получение используемой приложением RAM
|
||||
## SQLite 3
|
||||
|
||||
- [CREATE TABLE](sqlite/sqlite3_create.c)
|
||||
|
11
code/C/get_ram_usage.c
Normal file
11
code/C/get_ram_usage.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <sys/resource.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
struct rusage r_usage;
|
||||
getrusage(RUSAGE_SELF, &r_usage);
|
||||
|
||||
printf("Memory usage: %ld kilobytes\n", r_usage.ru_maxrss);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user