lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 28 Aug 2007 14:11:10 +0200 (CEST)
From:	Jan Engelhardt <jengelh@...putergmbh.de>
To:	Luka Napotnik <luka.napotnik@...il.com>
cc:	"linux-os (Dick Johnson)" <linux-os@...logic.com>,
	linux-kernel@...r.kernel.org
Subject: Re: division and cpu usage


On Aug 28 2007 12:41, Luka Napotnik wrote:
>
>How about this:
>===============================
>old_stime = task->stime;
>old_utime = task->utime
>old_j = jiffies;
>
>set_current_state(TASK_INTERRUPTIBLE);
>schedule_timeout(1 * HZ);
>
>new_stime = task->stime;
>new_utime = task->utime;
>new_j = jiffies;
>sum = ((new_stime - old_stime) + (new_utime - old_utime)) * 100 / (new_j
>- old_j)
>===============================
>
>I get how much time the task has spent in 1 sec in the scheduler and
>then get the percentage?

Looks sane to me. Though you have to try. And, like I said before, be aware of
dynticks, so you might want to use something else than jiffies. Not sure what
the function was called though.

	Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ