Project

General

Profile

Bug #234 ยป tsc_freq.patch

belczyk, 07/08/2006 07:21 PM

View differences:

sys/emulation/linux/i386/linprocfs/linprocfs_misc.c 8 Jul 2006 11:38:30 -0000
ps += sprintf(ps, "\n");
if (class >= 5) {
ps += sprintf(ps,
"cpu MHz\t\t: %d.%02d\n"
"bogomips\t: %d.%02d\n",
"cpu MHz\t\t: %qu.%02d\n"
"bogomips\t: %qu.%02d\n",
(tsc_freq + 4999) / 1000000,
((tsc_freq + 4999) / 10000) % 100,
(int)(((tsc_freq + 4999) / 10000) % 100),
(tsc_freq + 4999) / 1000000,
((tsc_freq + 4999) / 10000) % 100);
(int)(((tsc_freq + 4999) / 10000) % 100));
}
return (uiomove_frombuf(psbuf, ps - psbuf, uio));
sys/i386/i386/identcpu.c 8 Jul 2006 11:39:04 -0000
#endif
#if defined(I586_CPU)
case CPUCLASS_586:
printf("%d.%02d-MHz ",
printf("%qu.%02d-MHz ",
(tsc_freq + 4999) / 1000000,
((tsc_freq + 4999) / 10000) % 100);
(int)(((tsc_freq + 4999) / 10000) % 100));
printf("586");
break;
#endif
#if defined(I686_CPU)
case CPUCLASS_686:
printf("%d.%02d-MHz ",
printf("%qu.%02d-MHz ",
(tsc_freq + 4999) / 1000000,
((tsc_freq + 4999) / 10000) % 100);
(int)(((tsc_freq + 4999) / 10000) % 100));
printf("686");
break;
#endif
sys/i386/i386/perfmon.c 8 Jul 2006 10:33:41 -0000
}
pmct = (struct pmc_tstamp *)param;
/* XXX interface loses precision. */
pmct->pmct_rate = tsc_freq / 1000000;
pmct->pmct_rate = (int)(tsc_freq / 1000000);
pmct->pmct_value = rdtsc();
rv = 0;
break;
sys/i386/include/clock.h 8 Jul 2006 11:35:57 -0000
extern u_int timer_freq;
extern int timer0_max_count;
extern int tsc_present;
extern u_int tsc_freq;
extern u_int64_t tsc_freq;
extern int tsc_is_broken;
extern int wall_cmos_clock;
#ifdef APIC_IO
sys/i386/isa/clock.c 8 Jul 2006 11:40:20 -0000
int disable_rtc_set; /* disable resettodr() if != 0 */
int statclock_disable = 1; /* we don't use the statclock right now */
int tsc_present;
u_int tsc_freq; /* XXX obsolete, convert users */
int64_t tsc_frequency;
u_int64_t tsc_freq;
int tsc_is_broken;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
int timer0_running;
......
* similar to those for the i8254 clock.
*/
if (tsc_present) {
tsc_frequency = rdtsc() - old_tsc;
tsc_freq = (u_int)tsc_frequency; /* XXX */
tsc_freq = rdtsc() - old_tsc;
}
if (tsc_present)
printf("TSC clock: %u Hz, ", tsc_freq);
printf("TSC clock: %qu Hz, ", tsc_freq);
printf("i8254 clock: %u Hz\n", tot_count);
return (tot_count);
......
"%d Hz differs from default of %d Hz by more than 1%%\n",
freq, i8254_cputimer.freq);
tsc_freq = 0;
tsc_frequency = 0;
}
#ifndef CLK_USE_TSC_CALIBRATION
......
printf(
"CLK_USE_TSC_CALIBRATION not specified - using old calibration method\n");
tsc_freq = 0;
tsc_frequency = 0;
}
#endif
if (tsc_present && tsc_frequency == 0) {
if (tsc_present && tsc_freq == 0) {
/*
* Calibration of the i586 clock relative to the mc146818A
* clock failed. Do a less accurate calibration relative
......
u_int64_t old_tsc = rdtsc();
DELAY(1000000);
tsc_frequency = rdtsc() - old_tsc;
tsc_freq = (u_int)tsc_frequency;
tsc_freq = rdtsc() - old_tsc;
#ifdef CLK_USE_TSC_CALIBRATION
if (bootverbose)
printf("TSC clock: %u Hz (Method B)\n", tsc_freq);
printf("TSC clock: %qu Hz (Method B)\n", tsc_freq);
#endif
}
sys/net/altq/altq_subr.c 8 Jul 2006 10:18:32 -0000
* accessible, just use it.
*/
#ifdef __i386__
machclk_freq = tsc_freq;
machclk_freq = (uint32_t)tsc_freq; /* XXX */
#else
#error "machclk_freq interface not implemented"
#endif
sys/sys/gmon.h 8 Jul 2006 11:41:35 -0000
u_long hpc; /* max pc address of sampled buffer */
int ncnt; /* size of sample buffer (plus this header) */
int version; /* version number */
int profrate; /* profiling clock rate */
int spare[3]; /* reserved */
u_int64_t profrate; /* profiling clock rate */
int spare[2]; /* reserved */
/* XXX should record counter size and density */
};
#define GMONVERSION 0x00051879
#define GMONVERSION 0x0005187a
/*
* Type of histogram counters used in the kernel.
......
uintfptr_t highpc;
u_long textsize;
u_long hashfraction;
int profrate; /* XXX wrong type to match gmonhdr */
u_int64_t profrate; /* XXX wrong type to match gmonhdr */
HISTCOUNTER *cputime_count;
int cputime_overhead;
HISTCOUNTER *mcount_count;
usr.bin/gprof/gprof.c 8 Jul 2006 11:42:21 -0000
struct gmonhdr tmp;
FILE *pfile;
int size;
int rate;
u_int64_t rate;
if((pfile = fopen(filename, "r")) == NULL) {
perror(filename);
......
hz = rate;
} else if (hz != rate) {
fprintf(stderr,
"%s: profile clock rate (%d) %s (%d) in first gmon file\n",
"%s: profile clock rate (%qu) %s (%qu) in first gmon file\n",
filename, rate, "incompatible with clock rate", hz);
done();
}
......
lowpc , highpc );
printf( "[openpfile] sampbytes %d nsamples %d\n" ,
sampbytes , nsamples );
printf( "[openpfile] sample rate %d\n" , hz );
printf( "[openpfile] sample rate %qu\n" , hz );
}
# endif /* DEBUG */
return(pfile);
usr.bin/gprof/gprof.h 8 Jul 2006 11:42:42 -0000
/*
* ticks per second
*/
long hz;
u_int64_t hz;
#ifdef GPROF4
typedef int64_t UNIT;
usr.bin/ktrdump/ktrdump.c 8 Jul 2006 10:20:14 -0000
{ "_ktr_idx" },
{ "_ktr_buf" },
{ "_ncpus" },
{ "_tsc_frequency" },
{ "_tsc_freq" },
{ NULL }
};
    (1-1/1)