DragonFly BSD
DragonFly bugs List (threaded) for 2009-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

ps -S not working because kinfo_proc.kp_cru is not filled

From: Jan Lentfer <Jan.Lentfer@xxxxxx>
Date: Wed, 16 Dec 2009 10:33:32 +0100

when trying to improve top I was looking into ps's output when using option -S and found with the help of alexh that the numbers reported back or not what is described in man page:

-S : Change the way the process time is calculated by summing all exited children to their parent process

This seems due to the fact that for summing up childrens cpu time kinfo_proc.kp_cru is used in ps/print.c :

    443 	if (sumrusage) {
    444 		secs += KI_PROC(k, cru).ru_utime.tv_sec +
    445 			KI_PROC(k, cru).ru_stime.tv_sec;
    446 		psecs += KI_PROC(k, cru).ru_utime.tv_usec +
    447 			KI_PROC(k, cru).ru_stime.tv_usec;
    448 	}

scanning through DF sources in http://grok.x12.su gives me the impression that kinfo_proc.kp_cru is not filled anywhere.

Other BSDs use similar approach for ps -S (fbsd: ki_childtime, obsd: p_uctime_sec), but these contain actual data (fbsd: kern_proc.c,obsd: kvm_proc.c).

So the question is, is this a ps bug and we should remove option -S (or add note that this doesn't work on DF) or should we actually will kp_cru with meaningful data?

Preisknaller: WEB.DE DSL Flatrate für nur 16,99 Euro/mtl.! 

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]