VMware Cloud Community
dutchmontana
Contributor
Contributor

cpu time resolution

doug,

i had to change cpu time resolution in the .c files for various platforms. this is because in .c files, integer arithmetic would have already rounds off milliseconds. to get cpu usage of milliseconds, i took the approach of changing the .c files of various platforms at different places.

wayne
Reply
0 Kudos
4 Replies
dougm_hyperic
VMware Employee
VMware Employee

Hi Wayne,

Please share your changes (diff -u format preferred) so we can look
at integrating for future releases. Thanks.

On Feb 21, 2007, at 4:12 PM, wayne yu wrote:

> doug,
>
> i had to change cpu time resolution in the .c files for various
> platforms. this is because in .c files, integer arithmetic would
> have already rounds off milliseconds. to get cpu usage of
> milliseconds, i took the approach of changing the .c files of
> various platforms at different places.
>
> wayne
>



Reply
0 Kudos
dutchmontana
Contributor
Contributor

For linux:


I modified linux_sigar.c:

in fucntion:
static int proc_stat_read(sigar_t *sigar, sigar_pid_t pid){
...
pstat->utime = sigar_strtoull(ptr)*1000 / sigar->ticks; /* (14) */
pstat->stime = sigar_strtoull(ptr)*1000 / sigar->ticks; /* (15) */
...
}

I added 1000 multiplication out there.

Will send changes I made for two other platforms.

Regards
Reply
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee

What version of sigar are you using? We changed the cpu times to
millis in the 1.3.0 release, based on your earlier request:
http://jira.hyperic.com/browse/SIGAR-19

In the 1.3.0 version of linux_sigar.c you'll see:

pstat->utime = SIGAR_TICK2MSEC(sigar_strtoull(ptr)); /* (14) */
pstat->stime = SIGAR_TICK2MSEC(sigar_strtoull(ptr)); /* (15) */


On Feb 22, 2007, at 12:13 PM, wayne yu wrote:

> For linux:
>
>
> I modified linux_sigar.c:
>
> in fucntion:
> static int proc_stat_read(sigar_t *sigar, sigar_pid_t pid){
> ...
> pstat->utime = sigar_strtoull(ptr)*1000 / sigar->ticks; /* (14) */
> pstat->stime = sigar_strtoull(ptr)*1000 / sigar->ticks; /* (15) */
> ...
> }
>
> I added 1000 multiplication out there.
>
> Will send changes I made for two other platforms.
>
> Regards
>



Reply
0 Kudos
dutchmontana
Contributor
Contributor

need to start ur new version now. somehow, from source control, i did not see some c source files getting changed.
Reply
0 Kudos