Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: Tony Verhulst <verhulst@zk3.dec.com>
Subject: Re: [Q] System CPU speed ?
Date: 2000/05/18	[thread overview]
Message-ID: <39241F5F.5387EB6F@zk3.dec.com> (raw)
In-Reply-To: slrn8i8842.b8q.stefand@ferrari.lcam.u-psud.fr

"Stefan A. Deutscher" wrote:
> 
> Howdy,
> 
>  I have another one that has got to be a runner-up to 'how much memory
> do I have?': How do I figure out at what clock my Alpha box is ticking?


You should use getsysinfo().  Here's a sample program:

#include <sys/types.h>
#include <sys/errno.h>
#include <machine/hal_sysinfo.h>

int
main(argc, argv)
int argc;
char **argv;
{
        struct cpu_info cpu_info;

        if (getsysinfo(GSI_CPU_INFO, &cpu_info,
                                        sizeof(cpu_info), 0L, 0L) <= 0)
{
                perror("getsysinfo");
                exit( 0 );
        }

        printf("current_cpu = 0x%lx\n", cpu_info.current_cpu);
        printf("cpus_in_box = 0x%lx\n", cpu_info.cpus_in_box);
        printf("cpu_type = 0x%lx\n", cpu_info.cpu_type);
        printf("ncpus = 0x%lx\n", cpu_info.ncpus);
        printf("cpus_present = 0x%lx\n", cpu_info.cpus_present);
        printf("cpus_running = 0x%lx\n", cpu_info.cpus_running);
        printf("cpu_binding = 0x%lx\n", cpu_info.cpu_binding);
        printf("cpu_ex_binding = 0x%lx\n", cpu_info.cpu_ex_binding);
        printf("mhz = 0x%lx\n", cpu_info.mhz);
}



  parent reply	other threads:[~2000-05-18  4:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-18  4:00 [Q] System CPU speed ? Stefan A. Deutscher
2000-05-18  4:00 ` Adam Price
2000-05-18  4:00 ` Tony Verhulst [this message]
2000-05-18  4:00 ` Stuart R. Fuller
2000-05-27  4:00   ` Jack Patteeuw
2000-05-18  4:00 ` Stefan Moeding
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox