add system time measurement

This commit is contained in:
ІО-23 Шмуляр Олег 2025-03-07 14:07:59 +02:00
parent 06cd3a04a5
commit 6078c70649
2 changed files with 12 additions and 0 deletions

View File

@ -13,9 +13,13 @@ struct RunQ *runq;
struct PhysPage *first_free_page;
struct PhysPage *first_busy_page;
size_t system_time;
int
main(void)
{
system_time = 0;
first_busy_page = NULL;
first_free_page = malloc(sizeof(struct PhysPage));

View File

@ -2,6 +2,10 @@
#include "kernel.h"
extern size_t system_time;
void MMU_read(struct PageTableEntry *pt, size_t page_no)
{
if (!pt[page_no].p)
@ -9,6 +13,8 @@ void MMU_read(struct PageTableEntry *pt, size_t page_no)
printf("[mmu:read] pt[%d] -> ppn %d\n", page_no, pt[page_no].ppn);
pt[page_no].r = 1;
system_time++;
}
void MMU_write(struct PageTableEntry *pt, size_t page_no)
@ -19,4 +25,6 @@ void MMU_write(struct PageTableEntry *pt, size_t page_no)
printf("[mmu:write] pt[%d] -> ppn %d\n", page_no, pt[page_no].ppn);
pt[page_no].r = 1;
pt[page_no].m = 1;
system_time++;
}