1
1

btime: изменён способ определения временных меток

Этот коммит содержится в:
родитель 0e773acb47
Коммит 1036a12b0f
2 изменённых файлов: 8 добавлений и 11 удалений

Просмотреть файл

@ -23,4 +23,4 @@
### Примеры ### Примеры
```btime -s "Kernel Boot Time: ``` ```btime -s "Kernel Boot Time: "```

Просмотреть файл

@ -16,27 +16,24 @@
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int c; int c;
char *dstr = NULL; char *dstr = NULL;
uint64_t btime; int btime_sec, btime_nsec;
uint64_t cycles;
uint64_t cps;
while ( ( c = getopt( argc, argv, "s:" ) ) != -1 ) while ( ( c = getopt( argc, argv, "s:" ) ) != -1 )
{ {
switch ( c ) switch ( c )
{ {
case 's': // be verbose case 's':
dstr = optarg; dstr = optarg;
break; break;
} }
} }
cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec / 1000; btime_sec = SYSPAGE_ENTRY(qtime)->nsec / 1000000000;
cycles = ClockCycles(); btime_nsec = SYSPAGE_ENTRY(qtime)->nsec / 1000000 % 1000;
btime = cycles / cps;
printf( "%s %lldms\n", (dstr) ? dstr : "", btime ); printf( "[%3d.%03d c.] %s \n", btime_sec, btime_nsec, (dstr) ? dstr : "");
return ( 0 ); return ( 0 );
} }