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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 28 Aug 2007 08:45:00 +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 00:07, Luka Napotnik wrote:
>>>> 2. I'm trying to get the percentage of CPU used for a certain
>>>> task_struct and figured the following formula:
>>>>
>>>> (task->utime + task->stime) / jiffies
>
>This formula just doesn't work. I have a task with 99% CPU (top) but the
>result of that formula is random (4, sometimes 8). What am I doing
>wrong? Please help.

You are calculating the CPU time the process has used since the start.
That is definitely not the same as the "%CPU" that top shows, more like
the "TIME+" top shows by default.

-
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