tsc_freq.patch
| sys/emulation/linux/i386/linprocfs/linprocfs_misc.c 8 Jul 2006 11:38:30 -0000 | ||
|---|---|---|
| 231 | 231 |
ps += sprintf(ps, "\n"); |
| 232 | 232 |
if (class >= 5) {
|
| 233 | 233 |
ps += sprintf(ps, |
| 234 |
"cpu MHz\t\t: %d.%02d\n"
|
|
| 235 |
"bogomips\t: %d.%02d\n",
|
|
| 234 |
"cpu MHz\t\t: %qu.%02d\n"
|
|
| 235 |
"bogomips\t: %qu.%02d\n",
|
|
| 236 | 236 |
(tsc_freq + 4999) / 1000000, |
| 237 |
((tsc_freq + 4999) / 10000) % 100,
|
|
| 237 |
(int)(((tsc_freq + 4999) / 10000) % 100),
|
|
| 238 | 238 |
(tsc_freq + 4999) / 1000000, |
| 239 |
((tsc_freq + 4999) / 10000) % 100);
|
|
| 239 |
(int)(((tsc_freq + 4999) / 10000) % 100));
|
|
| 240 | 240 |
} |
| 241 | 241 |
|
| 242 | 242 |
return (uiomove_frombuf(psbuf, ps - psbuf, uio)); |
| sys/i386/i386/identcpu.c 8 Jul 2006 11:39:04 -0000 | ||
|---|---|---|
| 591 | 591 |
#endif |
| 592 | 592 |
#if defined(I586_CPU) |
| 593 | 593 |
case CPUCLASS_586: |
| 594 |
printf("%d.%02d-MHz ",
|
|
| 594 |
printf("%qu.%02d-MHz ",
|
|
| 595 | 595 |
(tsc_freq + 4999) / 1000000, |
| 596 |
((tsc_freq + 4999) / 10000) % 100);
|
|
| 596 |
(int)(((tsc_freq + 4999) / 10000) % 100));
|
|
| 597 | 597 |
printf("586");
|
| 598 | 598 |
break; |
| 599 | 599 |
#endif |
| 600 | 600 |
#if defined(I686_CPU) |
| 601 | 601 |
case CPUCLASS_686: |
| 602 |
printf("%d.%02d-MHz ",
|
|
| 602 |
printf("%qu.%02d-MHz ",
|
|
| 603 | 603 |
(tsc_freq + 4999) / 1000000, |
| 604 |
((tsc_freq + 4999) / 10000) % 100);
|
|
| 604 |
(int)(((tsc_freq + 4999) / 10000) % 100));
|
|
| 605 | 605 |
printf("686");
|
| 606 | 606 |
break; |
| 607 | 607 |
#endif |
| sys/i386/i386/perfmon.c 8 Jul 2006 10:33:41 -0000 | ||
|---|---|---|
| 383 | 383 |
} |
| 384 | 384 |
pmct = (struct pmc_tstamp *)param; |
| 385 | 385 |
/* XXX interface loses precision. */ |
| 386 |
pmct->pmct_rate = tsc_freq / 1000000;
|
|
| 386 |
pmct->pmct_rate = (int)(tsc_freq / 1000000);
|
|
| 387 | 387 |
pmct->pmct_value = rdtsc(); |
| 388 | 388 |
rv = 0; |
| 389 | 389 |
break; |
| sys/i386/include/clock.h 8 Jul 2006 11:35:57 -0000 | ||
|---|---|---|
| 26 | 26 |
extern u_int timer_freq; |
| 27 | 27 |
extern int timer0_max_count; |
| 28 | 28 |
extern int tsc_present; |
| 29 |
extern u_int tsc_freq;
|
|
| 29 |
extern u_int64_t tsc_freq;
|
|
| 30 | 30 |
extern int tsc_is_broken; |
| 31 | 31 |
extern int wall_cmos_clock; |
| 32 | 32 |
#ifdef APIC_IO |
| sys/i386/isa/clock.c 8 Jul 2006 11:40:20 -0000 | ||
|---|---|---|
| 115 | 115 |
int disable_rtc_set; /* disable resettodr() if != 0 */ |
| 116 | 116 |
int statclock_disable = 1; /* we don't use the statclock right now */ |
| 117 | 117 |
int tsc_present; |
| 118 |
u_int tsc_freq; /* XXX obsolete, convert users */ |
|
| 119 |
int64_t tsc_frequency; |
|
| 118 |
u_int64_t tsc_freq; |
|
| 120 | 119 |
int tsc_is_broken; |
| 121 | 120 |
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ |
| 122 | 121 |
int timer0_running; |
| ... | ... | |
| 559 | 558 |
* similar to those for the i8254 clock. |
| 560 | 559 |
*/ |
| 561 | 560 |
if (tsc_present) {
|
| 562 |
tsc_frequency = rdtsc() - old_tsc; |
|
| 563 |
tsc_freq = (u_int)tsc_frequency; /* XXX */ |
|
| 561 |
tsc_freq = rdtsc() - old_tsc; |
|
| 564 | 562 |
} |
| 565 | 563 | |
| 566 | 564 |
if (tsc_present) |
| 567 |
printf("TSC clock: %u Hz, ", tsc_freq);
|
|
| 565 |
printf("TSC clock: %qu Hz, ", tsc_freq);
|
|
| 568 | 566 |
printf("i8254 clock: %u Hz\n", tot_count);
|
| 569 | 567 |
return (tot_count); |
| 570 | 568 | |
| ... | ... | |
| 743 | 741 |
"%d Hz differs from default of %d Hz by more than 1%%\n", |
| 744 | 742 |
freq, i8254_cputimer.freq); |
| 745 | 743 |
tsc_freq = 0; |
| 746 |
tsc_frequency = 0; |
|
| 747 | 744 |
} |
| 748 | 745 | |
| 749 | 746 |
#ifndef CLK_USE_TSC_CALIBRATION |
| ... | ... | |
| 752 | 749 |
printf( |
| 753 | 750 |
"CLK_USE_TSC_CALIBRATION not specified - using old calibration method\n"); |
| 754 | 751 |
tsc_freq = 0; |
| 755 |
tsc_frequency = 0; |
|
| 756 | 752 |
} |
| 757 | 753 |
#endif |
| 758 |
if (tsc_present && tsc_frequency == 0) {
|
|
| 754 |
if (tsc_present && tsc_freq == 0) {
|
|
| 759 | 755 |
/* |
| 760 | 756 |
* Calibration of the i586 clock relative to the mc146818A |
| 761 | 757 |
* clock failed. Do a less accurate calibration relative |
| ... | ... | |
| 764 | 760 |
u_int64_t old_tsc = rdtsc(); |
| 765 | 761 | |
| 766 | 762 |
DELAY(1000000); |
| 767 |
tsc_frequency = rdtsc() - old_tsc; |
|
| 768 |
tsc_freq = (u_int)tsc_frequency; |
|
| 763 |
tsc_freq = rdtsc() - old_tsc; |
|
| 769 | 764 |
#ifdef CLK_USE_TSC_CALIBRATION |
| 770 | 765 |
if (bootverbose) |
| 771 |
printf("TSC clock: %u Hz (Method B)\n", tsc_freq);
|
|
| 766 |
printf("TSC clock: %qu Hz (Method B)\n", tsc_freq);
|
|
| 772 | 767 |
#endif |
| 773 | 768 |
} |
| 774 | 769 | |
| sys/net/altq/altq_subr.c 8 Jul 2006 10:18:32 -0000 | ||
|---|---|---|
| 734 | 734 |
* accessible, just use it. |
| 735 | 735 |
*/ |
| 736 | 736 |
#ifdef __i386__ |
| 737 |
machclk_freq = tsc_freq;
|
|
| 737 |
machclk_freq = (uint32_t)tsc_freq; /* XXX */
|
|
| 738 | 738 |
#else |
| 739 | 739 |
#error "machclk_freq interface not implemented" |
| 740 | 740 |
#endif |
| sys/sys/gmon.h 8 Jul 2006 11:41:35 -0000 | ||
|---|---|---|
| 50 | 50 |
u_long hpc; /* max pc address of sampled buffer */ |
| 51 | 51 |
int ncnt; /* size of sample buffer (plus this header) */ |
| 52 | 52 |
int version; /* version number */ |
| 53 |
int profrate; /* profiling clock rate */
|
|
| 54 |
int spare[3]; /* reserved */
|
|
| 53 |
u_int64_t profrate; /* profiling clock rate */
|
|
| 54 |
int spare[2]; /* reserved */
|
|
| 55 | 55 |
/* XXX should record counter size and density */ |
| 56 | 56 |
}; |
| 57 |
#define GMONVERSION 0x00051879
|
|
| 57 |
#define GMONVERSION 0x0005187a
|
|
| 58 | 58 | |
| 59 | 59 |
/* |
| 60 | 60 |
* Type of histogram counters used in the kernel. |
| ... | ... | |
| 172 | 172 |
uintfptr_t highpc; |
| 173 | 173 |
u_long textsize; |
| 174 | 174 |
u_long hashfraction; |
| 175 |
int profrate; /* XXX wrong type to match gmonhdr */
|
|
| 175 |
u_int64_t profrate; /* XXX wrong type to match gmonhdr */
|
|
| 176 | 176 |
HISTCOUNTER *cputime_count; |
| 177 | 177 |
int cputime_overhead; |
| 178 | 178 |
HISTCOUNTER *mcount_count; |
| usr.bin/gprof/gprof.c 8 Jul 2006 11:42:21 -0000 | ||
|---|---|---|
| 255 | 255 |
struct gmonhdr tmp; |
| 256 | 256 |
FILE *pfile; |
| 257 | 257 |
int size; |
| 258 |
int rate;
|
|
| 258 |
u_int64_t rate;
|
|
| 259 | 259 | |
| 260 | 260 |
if((pfile = fopen(filename, "r")) == NULL) {
|
| 261 | 261 |
perror(filename); |
| ... | ... | |
| 281 | 281 |
hz = rate; |
| 282 | 282 |
} else if (hz != rate) {
|
| 283 | 283 |
fprintf(stderr, |
| 284 |
"%s: profile clock rate (%d) %s (%d) in first gmon file\n",
|
|
| 284 |
"%s: profile clock rate (%qu) %s (%qu) in first gmon file\n",
|
|
| 285 | 285 |
filename, rate, "incompatible with clock rate", hz); |
| 286 | 286 |
done(); |
| 287 | 287 |
} |
| ... | ... | |
| 301 | 301 |
lowpc , highpc ); |
| 302 | 302 |
printf( "[openpfile] sampbytes %d nsamples %d\n" , |
| 303 | 303 |
sampbytes , nsamples ); |
| 304 |
printf( "[openpfile] sample rate %d\n" , hz );
|
|
| 304 |
printf( "[openpfile] sample rate %qu\n" , hz );
|
|
| 305 | 305 |
} |
| 306 | 306 |
# endif /* DEBUG */ |
| 307 | 307 |
return(pfile); |
| usr.bin/gprof/gprof.h 8 Jul 2006 11:42:42 -0000 | ||
|---|---|---|
| 76 | 76 |
/* |
| 77 | 77 |
* ticks per second |
| 78 | 78 |
*/ |
| 79 |
long hz;
|
|
| 79 |
u_int64_t hz;
|
|
| 80 | 80 | |
| 81 | 81 |
#ifdef GPROF4 |
| 82 | 82 |
typedef int64_t UNIT; |
| usr.bin/ktrdump/ktrdump.c 8 Jul 2006 10:20:14 -0000 | ||
|---|---|---|
| 67 | 67 |
{ "_ktr_idx" },
|
| 68 | 68 |
{ "_ktr_buf" },
|
| 69 | 69 |
{ "_ncpus" },
|
| 70 |
{ "_tsc_frequency" },
|
|
| 70 |
{ "_tsc_freq" },
|
|
| 71 | 71 |
{ NULL }
|
| 72 | 72 |
}; |
| 73 | 73 | |