Re: tiny lib/libkvm/kvm_proc.c correction

2010-03-11 Thread Alexander Best
John Baldwin schrieb am 2010-03-08:
> On Saturday 06 March 2010 3:39:17 am Ulrich Spörlein wrote:
> > On Fri, 05.03.2010 at 12:38:40 -0800, Xin LI wrote:
> > > On 2010/03/05 11:59, Alexander Best wrote:
> > > > Xin LI schrieb am 2010-03-05:
> > > > On 2010/03/05 11:26, Alexander Best wrote:
> > >  hi there. does this look right?

> > > > Not to me, the value is not to be used this way and the
> > > > comments
> > > > above the code explained the same thing.

> > > > I think we should use cputick2usec but it's not available to
> > > > userland
> > > > (one have to copy cpu_tick_frequency and friends).

> > > >> damn you're right. i completely overlooked that comment. would
> > > >> it be
> worth
> > > >> making cputick2usec available to userland? is kvm_proc.c the
> > > >> only
> candidate in
> > > >> need of converting cpu ticks to usecs?

> > > I'm not sure how to do that unfortunately, is there a way to
> > > expose a
> > > kernel variable to userland which also works on a crash dump?

> > ticks *is* available to libkvm, not sure what happens on
> > crashdumps,
> > though. The following patchset has not been tested:

i've just had a look at the overall use of bintime2timeval in the src. it's
not used very often. i only found a handful of calls and in fact with the
exception of kvm_proc.c bintime2timeval() always gets used with a proper
struct bintime.

so i guess it's okay to import cputick2usec() exclusively to kvm_proc.c.

cheers.
alex

> https://www.spoerlein.net/gitweb/?p=freebsd.work/.git;a=commitdiff;h=d500a051eb75dd234166bb11485c0a953aefce1d

> I'm fine with this patch so long as you are reading 'ticks' from the
> crash
> dump.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: tiny lib/libkvm/kvm_proc.c correction

2010-03-08 Thread John Baldwin
On Saturday 06 March 2010 3:39:17 am Ulrich Spörlein wrote:
> On Fri, 05.03.2010 at 12:38:40 -0800, Xin LI wrote:
> > On 2010/03/05 11:59, Alexander Best wrote:
> > > Xin LI schrieb am 2010-03-05:
> > > On 2010/03/05 11:26, Alexander Best wrote:
> >  hi there. does this look right?
> > > 
> > > Not to me, the value is not to be used this way and the comments
> > > above the code explained the same thing.
> > > 
> > > I think we should use cputick2usec but it's not available to userland
> > > (one have to copy cpu_tick_frequency and friends).
> > > 
> > >> damn you're right. i completely overlooked that comment. would it be 
worth
> > >> making cputick2usec available to userland? is kvm_proc.c the only 
candidate in
> > >> need of converting cpu ticks to usecs?
> > 
> > I'm not sure how to do that unfortunately, is there a way to expose a
> > kernel variable to userland which also works on a crash dump?
> 
> ticks *is* available to libkvm, not sure what happens on crashdumps,
> though. The following patchset has not been tested:
> 
> 
https://www.spoerlein.net/gitweb/?p=freebsd.work/.git;a=commitdiff;h=d500a051eb75dd234166bb11485c0a953aefce1d

I'm fine with this patch so long as you are reading 'ticks' from the crash 
dump.

-- 
John Baldwin
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: tiny lib/libkvm/kvm_proc.c correction

2010-03-06 Thread Alexander Best
Ulrich Spörlein schrieb am 2010-03-06:
> On Fri, 05.03.2010 at 12:38:40 -0800, Xin LI wrote:
> > On 2010/03/05 11:59, Alexander Best wrote:
> > > Xin LI schrieb am 2010-03-05:
> > > On 2010/03/05 11:26, Alexander Best wrote:
> >  hi there. does this look right?

> > > Not to me, the value is not to be used this way and the comments
> > > above the code explained the same thing.

> > > I think we should use cputick2usec but it's not available to
> > > userland
> > > (one have to copy cpu_tick_frequency and friends).

> > >> damn you're right. i completely overlooked that comment. would
> > >> it be worth
> > >> making cputick2usec available to userland? is kvm_proc.c the
> > >> only candidate in
> > >> need of converting cpu ticks to usecs?

> > I'm not sure how to do that unfortunately, is there a way to expose
> > a
> > kernel variable to userland which also works on a crash dump?

> ticks *is* available to libkvm, not sure what happens on crashdumps,
> though. The following patchset has not been tested:

very nice, but wouldn't it be better to define cputick2usec() somewhere else
so other userland code can make use of it? even if right now libkvm is the
only source in need of such a conversion function, in the future other code
might benefit from userland cputick2usec(). now where would be a good place to
put this in?

alex

ps: did anybody look @ {net|open|dragonfly}bsd, linux, solaris, etc. so see if
they have a userland cputick2usec() and where it's defined?

> https://www.spoerlein.net/gitweb/?p=freebsd.work/.git;a=commitdiff;h=d500a051eb75dd234166bb11485c0a953aefce1d

> Regards,
> Uli
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: tiny lib/libkvm/kvm_proc.c correction

2010-03-06 Thread Ulrich Spörlein
On Fri, 05.03.2010 at 12:38:40 -0800, Xin LI wrote:
> On 2010/03/05 11:59, Alexander Best wrote:
> > Xin LI schrieb am 2010-03-05:
> > On 2010/03/05 11:26, Alexander Best wrote:
>  hi there. does this look right?
> > 
> > Not to me, the value is not to be used this way and the comments
> > above the code explained the same thing.
> > 
> > I think we should use cputick2usec but it's not available to userland
> > (one have to copy cpu_tick_frequency and friends).
> > 
> >> damn you're right. i completely overlooked that comment. would it be worth
> >> making cputick2usec available to userland? is kvm_proc.c the only 
> >> candidate in
> >> need of converting cpu ticks to usecs?
> 
> I'm not sure how to do that unfortunately, is there a way to expose a
> kernel variable to userland which also works on a crash dump?

ticks *is* available to libkvm, not sure what happens on crashdumps,
though. The following patchset has not been tested:

https://www.spoerlein.net/gitweb/?p=freebsd.work/.git;a=commitdiff;h=d500a051eb75dd234166bb11485c0a953aefce1d

Regards,
Uli
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: tiny lib/libkvm/kvm_proc.c correction

2010-03-05 Thread Xin LI
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2010/03/05 11:59, Alexander Best wrote:
> Xin LI schrieb am 2010-03-05:
> On 2010/03/05 11:26, Alexander Best wrote:
 hi there. does this look right?
> 
> Not to me, the value is not to be used this way and the comments
> above
> the code explained the same thing.
> 
> I think we should use cputick2usec but it's not available to userland
> (one have to copy cpu_tick_frequency and friends).
> 
>> damn you're right. i completely overlooked that comment. would it be worth
>> making cputick2usec available to userland? is kvm_proc.c the only candidate 
>> in
>> need of converting cpu ticks to usecs?

I'm not sure how to do that unfortunately, is there a way to expose a
kernel variable to userland which also works on a crash dump?

Cheers,
- -- 
Xin LI http://www.delphij.net/
FreeBSD - The Power to Serve!  Live free or die
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (FreeBSD)

iQEcBAEBAgAGBQJLkWvQAAoJEATO+BI/yjfB1zYH/jNcRww4bePZqVl7zM9zUsyA
a6LZ9JivHSgxmMfcLSrqJMBdLdTFgSPFkP7bADKMDoSE/qY6zDMFbid+GVqn1XGk
8jTJiiTXmMkb24+43oQPvVgw3XPoSJJdrJIOlHPr3rzIkHFE0M0ivMETA95WBEQJ
uPHQcCSLSRAgdLju+PzfOTq4UiCZ4SXdLfbw+xrLB4IVKzjgtKQL1XYXL5Lgpc94
+OVV30471gZyjJM79aiVYzNs6ZMKTrxxHbUJujgFM3irfJrxVf52XNTa0vmBI6aW
yL58dQo+q1/KnzLOpK+T7+c33ZUKakSzkMCxN/IJdUteOHqquZSS0EEEcAkDGKI=
=IN3b
-END PGP SIGNATURE-
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: tiny lib/libkvm/kvm_proc.c correction

2010-03-05 Thread Alexander Best
Xin LI schrieb am 2010-03-05:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1

> On 2010/03/05 11:26, Alexander Best wrote:
> > hi there. does this look right?

> Not to me, the value is not to be used this way and the comments
> above
> the code explained the same thing.

> I think we should use cputick2usec but it's not available to userland
> (one have to copy cpu_tick_frequency and friends).

damn you're right. i completely overlooked that comment. would it be worth
making cputick2usec available to userland? is kvm_proc.c the only candidate in
need of converting cpu ticks to usecs?

alex

> Cheers,
> - --
> Xin LI http://www.delphij.net/
> FreeBSD - The Power to Serve!  Live free or die
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (FreeBSD)

> iQEcBAEBAgAGBQJLkV1EAAoJEATO+BI/yjfBvhcH/3LD5SOscV7wmzVazQtvhOpd
> C4xhRlnlZEniI8qrKP1L55Q9eTntxzcWZPhmImb5UspSX6a5aRsWHrySlD82Vjgy
> u/n/tz/YbhGV4QasmRxrXOF8wrPh3ie0W6912hFHmMZ6shgfm9GvoAlltnCcnnNp
> O330syWOVqf/q+9y5FOXIschYPs8HmAP7Fy5pMragpzdmpg5uCBdKXbekvfqiscN
> qPOOrzzyvkmXS3rKBY5vnRHqJTaOveSuE6KEjN1x/D0ZJ71kY6tLwZCCMc9wNlJB
> Dv/U3ZPo4lUki2tZTOi9bo4KEkLR/3zrFQ5VeaDhYI/FHCQTFB1jhNoahU2WlB0=
> =JOn5
> -END PGP SIGNATURE-
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


Re: tiny lib/libkvm/kvm_proc.c correction

2010-03-05 Thread Xin LI
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2010/03/05 11:26, Alexander Best wrote:
> hi there. does this look right?

Not to me, the value is not to be used this way and the comments above
the code explained the same thing.

I think we should use cputick2usec but it's not available to userland
(one have to copy cpu_tick_frequency and friends).

Cheers,
- -- 
Xin LI http://www.delphij.net/
FreeBSD - The Power to Serve!  Live free or die
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (FreeBSD)

iQEcBAEBAgAGBQJLkV1EAAoJEATO+BI/yjfBvhcH/3LD5SOscV7wmzVazQtvhOpd
C4xhRlnlZEniI8qrKP1L55Q9eTntxzcWZPhmImb5UspSX6a5aRsWHrySlD82Vjgy
u/n/tz/YbhGV4QasmRxrXOF8wrPh3ie0W6912hFHmMZ6shgfm9GvoAlltnCcnnNp
O330syWOVqf/q+9y5FOXIschYPs8HmAP7Fy5pMragpzdmpg5uCBdKXbekvfqiscN
qPOOrzzyvkmXS3rKBY5vnRHqJTaOveSuE6KEjN1x/D0ZJ71kY6tLwZCCMc9wNlJB
Dv/U3ZPo4lUki2tZTOi9bo4KEkLR/3zrFQ5VeaDhYI/FHCQTFB1jhNoahU2WlB0=
=JOn5
-END PGP SIGNATURE-
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


tiny lib/libkvm/kvm_proc.c correction

2010-03-05 Thread Alexander Best
hi there. does this look right?

cheers.
alex
Index: lib/libkvm/kvm_proc.c
===
--- lib/libkvm/kvm_proc.c   (revision 204763)
+++ lib/libkvm/kvm_proc.c   (working copy)
@@ -371,7 +371,7 @@
 * to convert cputicks to usecs.  The kernel does it in
 * kern/kern_tc.c, but the function can't be just copied.
 */
-   bintime2timeval(&proc.p_rux.rux_runtime, &tv);
+   bintime2timeval((struct bintime *)proc.p_rux.rux_runtime, &tv);
kp->ki_runtime = (u_int64_t)tv.tv_sec * 100 + tv.tv_usec;
kp->ki_pid = proc.p_pid;
kp->ki_siglist = proc.p_siglist;
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"