ACPI-fast default timecounter, but HPET 83% faster

View: New views
5 Messages — Rating Filter:   Alert me  

ACPI-fast default timecounter, but HPET 83% faster

by Pieter de Goeje :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear hackers,

While fiddling with the sysctl kern.timecounter.hardware, I found out that on
my system HPET is significantly faster than ACPI-fast. Using the program
below I measured the number of clock_gettime() calls the system can execute
per second. I ran the program 10 times for each configuration and here are
the results:

x ACPI-fast
+ HPET
+-------------------------------------------------------------------------+
|x                                                                       +|
|x                                                                       +|
|x                                                                      ++|
|x                                                                      ++|
|x                                                                      ++|
|x                                                                      ++|
|A                                                                      |A|
+-------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10        822032        823752        823551      823397.8     509.43254
+  10       1498348       1506862       1502830     1503267.4     2842.9779
Difference at 95.0% confidence
        679870 +/- 1918.94
        82.5688% +/- 0.233052%
        (Student's t, pooled s = 2042.31)

System details: Intel(R) Core(TM)2 Duo CPU E6750  @ 2.66GHz (3200.02-MHz
686-class CPU), Gigabyte P35-DS3R motherboard running i386 -CURRENT updated
today.

Unfortunately I only have one system with a HPET timecounter, so I cannot
verify these results on another system. If similar results are obtained on
other machines, I think the HPET timecounter quality needs to be increased
beyond that of ACPI-fast.

Regards,

Pieter de Goeje

----- 8< ----- clock_gettime.c ----- 8< ------
#include <sys/time.h>
#include <stdio.h>
#include <time.h>

#define COUNT 1000000

int main() {
        struct timespec ts_start, ts_stop, ts_read;
        double time;
        int i;

        clock_gettime(CLOCK_MONOTONIC, &ts_start);
        for(i = 0; i < COUNT; i++) {
                clock_gettime(CLOCK_MONOTONIC, &ts_read);
        }
        clock_gettime(CLOCK_MONOTONIC, &ts_stop);

        time = (ts_stop.tv_sec - ts_start.tv_sec) + (ts_stop.tv_nsec -
ts_start.tv_nsec) * 1E-9;
        printf("%.0f\n", COUNT / time);
}
_______________________________________________
freebsd-performance@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "freebsd-performance-unsubscribe@..."

Re: ACPI-fast default timecounter, but HPET 83% faster

by Garrett Cooper-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Apr 26, 2009 at 4:50 PM, Pieter de Goeje <pieter@...> wrote:

> Dear hackers,
>
> While fiddling with the sysctl kern.timecounter.hardware, I found out that on
> my system HPET is significantly faster than ACPI-fast. Using the program
> below I measured the number of clock_gettime() calls the system can execute
> per second. I ran the program 10 times for each configuration and here are
> the results:
>
> x ACPI-fast
> + HPET
> +-------------------------------------------------------------------------+
> |x                                                                       +|
> |x                                                                       +|
> |x                                                                      ++|
> |x                                                                      ++|
> |x                                                                      ++|
> |x                                                                      ++|
> |A                                                                      |A|
> +-------------------------------------------------------------------------+
>    N           Min           Max        Median           Avg        Stddev
> x  10        822032        823752        823551      823397.8     509.43254
> +  10       1498348       1506862       1502830     1503267.4     2842.9779
> Difference at 95.0% confidence
>        679870 +/- 1918.94
>        82.5688% +/- 0.233052%
>        (Student's t, pooled s = 2042.31)
>
> System details: Intel(R) Core(TM)2 Duo CPU E6750  @ 2.66GHz (3200.02-MHz
> 686-class CPU), Gigabyte P35-DS3R motherboard running i386 -CURRENT updated
> today.
>
> Unfortunately I only have one system with a HPET timecounter, so I cannot
> verify these results on another system. If similar results are obtained on
> other machines, I think the HPET timecounter quality needs to be increased
> beyond that of ACPI-fast.
>
> Regards,
>
> Pieter de Goeje
>
> ----- 8< ----- clock_gettime.c ----- 8< ------
> #include <sys/time.h>
> #include <stdio.h>
> #include <time.h>
>
> #define COUNT 1000000
>
> int main() {
>        struct timespec ts_start, ts_stop, ts_read;
>        double time;
>        int i;
>
>        clock_gettime(CLOCK_MONOTONIC, &ts_start);
>        for(i = 0; i < COUNT; i++) {
>                clock_gettime(CLOCK_MONOTONIC, &ts_read);
>        }
>        clock_gettime(CLOCK_MONOTONIC, &ts_stop);
>
>        time = (ts_stop.tv_sec - ts_start.tv_sec) + (ts_stop.tv_nsec -
> ts_start.tv_nsec) * 1E-9;
>        printf("%.0f\n", COUNT / time);
> }

I'm seeing similar results.

[root@orangebox /usr/home/gcooper]# dmesg | grep 'Timecounter "'
Timecounter "i8254" frequency 1193182 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
Timecounter "HPET" frequency 14318180 Hz quality 900
[root@orangebox /usr/home/gcooper]# ./cgt
1369355
[root@orangebox /usr/home/gcooper]# sysctl
kern.timecounter.hardware="ACPI-fast"
kern.timecounter.hardware: HPET -> ACPI-fast
[root@orangebox /usr/home/gcooper]# ./cgt
772289

Why's the default ACPI-fast? For power-saving functionality or because
of the `quality' factor? What is the criteria that determines the
`quality' of a clock as what's being reported above (I know what
determines the quality of a clock visually from a oscilloscope =])?

Thanks,
-Garrett
_______________________________________________
freebsd-performance@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "freebsd-performance-unsubscribe@..."

Re: ACPI-fast default timecounter, but HPET 83% faster

by John Baldwin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 26 April 2009 10:27:42 pm Garrett Cooper wrote:

> I'm seeing similar results.
>
> [root@orangebox /usr/home/gcooper]# dmesg | grep 'Timecounter "'
> Timecounter "i8254" frequency 1193182 Hz quality 0
> Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
> Timecounter "HPET" frequency 14318180 Hz quality 900
> [root@orangebox /usr/home/gcooper]# ./cgt
> 1369355
> [root@orangebox /usr/home/gcooper]# sysctl
> kern.timecounter.hardware="ACPI-fast"
> kern.timecounter.hardware: HPET -> ACPI-fast
> [root@orangebox /usr/home/gcooper]# ./cgt
> 772289
>
> Why's the default ACPI-fast? For power-saving functionality or because
> of the `quality' factor? What is the criteria that determines the
> `quality' of a clock as what's being reported above (I know what
> determines the quality of a clock visually from a oscilloscope =])?

I suspect that the quality of the HPET driver is lower simply because no one
had measured it previously and HPET is newer and less "proven".

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

Re: ACPI-fast default timecounter, but HPET 83% faster

by Bruce Cran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 30 Apr 2009 08:46:41 -0400
John Baldwin <jhb@...> wrote:

> On Sunday 26 April 2009 10:27:42 pm Garrett Cooper wrote:

> > Why's the default ACPI-fast? For power-saving functionality or
> > because of the `quality' factor? What is the criteria that
> > determines the `quality' of a clock as what's being reported above
> > (I know what determines the quality of a clock visually from a
> > oscilloscope =])?
>
> I suspect that the quality of the HPET driver is lower simply because
> no one had measured it previously and HPET is newer and less "proven".
>

http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/acpica/acpi_hpet.c
shows some of the history behind the decision.  Apparently it used to
be slower but it was hoped it would get faster as systems supported it
better. I guess that's happening now.

--
Bruce Cran
_______________________________________________
freebsd-performance@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "freebsd-performance-unsubscribe@..."

Re: ACPI-fast default timecounter, but HPET 83% faster

by Kris Kennaway-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John Baldwin wrote:

> On Sunday 26 April 2009 10:27:42 pm Garrett Cooper wrote:
>> I'm seeing similar results.
>>
>> [root@orangebox /usr/home/gcooper]# dmesg | grep 'Timecounter "'
>> Timecounter "i8254" frequency 1193182 Hz quality 0
>> Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
>> Timecounter "HPET" frequency 14318180 Hz quality 900
>> [root@orangebox /usr/home/gcooper]# ./cgt
>> 1369355
>> [root@orangebox /usr/home/gcooper]# sysctl
>> kern.timecounter.hardware="ACPI-fast"
>> kern.timecounter.hardware: HPET -> ACPI-fast
>> [root@orangebox /usr/home/gcooper]# ./cgt
>> 772289
>>
>> Why's the default ACPI-fast? For power-saving functionality or because
>> of the `quality' factor? What is the criteria that determines the
>> `quality' of a clock as what's being reported above (I know what
>> determines the quality of a clock visually from a oscilloscope =])?
>
> I suspect that the quality of the HPET driver is lower simply because no one
> had measured it previously and HPET is newer and less "proven".
>

 From memory, HPET was massively slower on some of the AMD test hardware
I was using.  There was a thread about it on one of the mailing lists,
but I can't find it right now.

Kris
_______________________________________________
freebsd-performance@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "freebsd-performance-unsubscribe@..."