From 1036a12b0f4e34eca62159e41a8818468b1a3e9f Mon Sep 17 00:00:00 2001 From: cbdbc Date: Thu, 9 Mar 2023 01:12:34 +0300 Subject: [PATCH] =?UTF-8?q?btime:=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D1=91?= =?UTF-8?q?=D0=BD=20=D1=81=D0=BF=D0=BE=D1=81=D0=BE=D0=B1=20=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/btime/README.md | 2 +- utils/btime/main.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/utils/btime/README.md b/utils/btime/README.md index 0f94dc4..e692c21 100644 --- a/utils/btime/README.md +++ b/utils/btime/README.md @@ -23,4 +23,4 @@ ### Примеры -```btime -s "Kernel Boot Time: ``` +```btime -s "Kernel Boot Time: "``` diff --git a/utils/btime/main.c b/utils/btime/main.c index b5af169..28875d2 100644 --- a/utils/btime/main.c +++ b/utils/btime/main.c @@ -16,27 +16,24 @@ int main (int argc, char *argv[]) { - int c; - char *dstr = NULL; - uint64_t btime; - uint64_t cycles; - uint64_t cps; + int c; + char *dstr = NULL; + int btime_sec, btime_nsec; while ( ( c = getopt( argc, argv, "s:" ) ) != -1 ) { switch ( c ) { - case 's': // be verbose + case 's': dstr = optarg; break; } } - cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec / 1000; - cycles = ClockCycles(); - btime = cycles / cps; + btime_sec = SYSPAGE_ENTRY(qtime)->nsec / 1000000000; + btime_nsec = SYSPAGE_ENTRY(qtime)->nsec / 1000000 % 1000; - printf( "%s %lldms\n", (dstr) ? dstr : "", btime ); + printf( "[%3d.%03d c.] %s \n", btime_sec, btime_nsec, (dstr) ? dstr : ""); return ( 0 ); }