view src/usr/dummy.c @ 13:16f496e8b857

implement ticks syscall
author anatofuz
date Sat, 22 Jun 2019 13:19:06 +0900
parents
children
line wrap: on
line source

#include "types.h"
#include "stat.h"
#include "user.h"
#include "fs.h"

int
main(int argc, char *argv[])
{
    int i;
    int n;
    long load = 0x100;
    int priority;
    //char this_proc_name[512];
    priority = 5;
    //strcpy(this_proc_name,"undef");

    if(argc == 4){
        priority = atoi(argv[1]);
        load = atoi(argv[2]); 
        n    = atoi(argv[3]);
    }

    setpriority(priority);
    printf(1," %d : count = %d\n",n,getdwt());

    for(i=0; i<load; i++){
       __asm__ __volatile__ ("");
    }

    // number of cycles stored in count variable
    printf(1," %d : count = %d\n",n,getdwt());
    exit();
}