[Bug 262215] Two imprecisions in cputime counters

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 21 Mar 2022 13:34:45 UTC

--- Comment #5 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:


commit bb53dd56c30c6360fc82be762ed98b0af6b9f69f
Author:     firk <firk@cantconnect.ru>
AuthorDate: 2022-03-21 13:33:11 +0000
Commit:     George V. Neville-Neil <gnn@FreeBSD.org>
CommitDate: 2022-03-21 13:33:46 +0000

    kern_tc.c/cputick2usec() (which is used to calculate cputime from
    cpu ticks) has some imprecision and, worse, huge timestep (about
    20 minutes on 4GHz CPU) near 53.4 days of elapsed time.

    kern_time.c/cputick2timespec() (it is used for clock_gettime() for
    querying process or thread consumed cpu time) Uses cputick2usec()
    and then needlessly converting usec to nsec, obviously losing
    precision even with fixed cputick2usec().

    kern_time.c/kern_clock_getres() uses some weird (anyway wrong)
    formula for getting cputick resolution.

    PR:             262215
    Reviewed by:    gnn
    Differential Revision:  https://reviews.freebsd.org/D34558

 lib/libkvm/kvm_proc.c |  9 ++-------
 sys/kern/kern_tc.c    | 12 +++---------
 sys/kern/kern_time.c  | 12 +++++-------
 3 files changed, 10 insertions(+), 23 deletions(-)

You are receiving this mail because:
You are the assignee for the bug.