perfmon
—
CPU
????ǽ???˥????륤?ե?????
cpu "I586_CPU"
cpu
"I686_CPU"
options PERFMON
perfmon
?ɥ饤?Фˤ??? Intel ??
Pentium ?? Pentium Pro ?? CPU
????????ǽ???˥?????ǽ?˥????????Ǥ??ޤ???
???????Υץ????å??ˤ?¿?̤ʥ??٥??ȤˤĤ???ȯ???????ޤ???
(CPU ?????????Ǥ?)
??³???֤Τɤ??餫??¬?ꤹ???褦???????Ǥ???
2
?Ĥ??????????ȡ?Ʊ?????????å?????????????????
1 ?ĤΥ??????륫?????????????Ƥ??ޤ???
perfmon
?ɥ饤?ФǤϤ??????ε?ǽ???Ф??ƥǥХ????????ˤ??륤?ե???????????
???ޤ???
??ǽ???˥????륫???ؤ????ƤΥ?????????
?ǥХ??????ü??ե???????
“/dev/perfmon”
?????Ȥ??ƽ????????ޤ???
???ΥǥХ?????????
ioctl(2)
?ꥯ?????Ȥ?¿??????
⟨machine/perfmon.h⟩
?????????????졢???Υե??????????ˤ? Pentium ??
Pentium Pro
?ץ????å???ξ???ο????ʥ??????????⤢???ޤ???
???ջ???:
???Ѳ?ǽ?ʥ??٥??Ȥν????ϥץ????å????˰ۤʤ??ޤ???
???Ѥ????륤?٥??ȥ????ɤ?¬?ꤵ????
CPU ?η??????Ф???
Ŭ???Ǥ??뤳?Ȥ???ǧ???뤳?Ȥϥץ??????ޤ???Ǥ?Ǥ???
?ʲ???
ioctl(2)
?ꥯ?????Ȥ??????????Ƥ??ޤ?:
PMIOSETUP
- (
struct pmc
)
??¤?Τ??????????Ƥ????ѥ?????ȥե饰?ǥ????????ꤷ?ޤ???
?ʲ??Υե??????ɤ? struct
pmc
???????????Ƥ??ޤ?:
int
pmc_num
- ???ꤹ?륫???????ֹ??Ǥ???
NPMC
(???ߤ? 2)
???꾮?????ʤ????Фʤ??ޤ?????
u_char
pmc_event
- ???˥????٤??????Υ??٥??ȥ????ɤǡ?
⟨machine/perfmon.h⟩
???????????Ƥ??ޤ???
u_char
pmc_unit
- ???٥??Ȥη????б????????֤Υޥ??????ͤǤ?
( Intel ??ʸ????)??
u_char
pmc_flags
- ??????Ư?????ѹ??????ե饰 (????????)
?Ǥ???
u_char
pmc_mask
- ?????Υޥ??????ͤǤ????Ĥޤꡢ???衢?????ͤϻ??ꤵ?줿???Υ????å?
?ʾ? (???ϰʲ?)
?δַ?³???륤?٥??Ȥ˥??????Ȥ????¤????٤˻??Ѥ????뤷??????
?Ǥ???
???Τ褦?? pmc_flags
???ͤ??????????Ƥ??ޤ?:
PMCF_USR
- ???٥??Ȥ??桼???⡼?ɤǥ??????Ȥ??ޤ???
PMCF_OS
- ???٥??Ȥ??ͥ??⡼?ɤǥ??????Ȥ??ޤ???
PMCF_E
- ???٥??Ȥ???³???֤ǤϤʤ????ο??ǥ??????Ȥ??ޤ???
PMCF_INV
- ?????Υޥ????????Ӥΰ?̣????ž???ޤ???
PMIOGET
- (
struct pmc
)
???ꤵ?줿?????θ??ߤ????????֤??ޤ???
PMIOSTART
-
PMIOSTOP
- (
int
) ???ꤷ??????????ư
(????)
???ޤ????ϡ??ɥ??????η??٤ˤ??ꡢ?ֹ?????
??ư?????ߤʤ????Фʤ??ޤ?????
(¨???????????? 0 ??ɬ???ޤ????????? 1
?????ߤ??Ƥ??????ߤ??ʤ????Фʤ??ޤ???)??
?ɥ饤?ФǤϤ?????????
???????Ƥ??ޤ???
(?ȸ????Τ⾭???? CPU
?ǤϤ????????Ϥʤ??ʤ뤫???Τ??ޤ???)??
PMIORESET
- (
int
) ???ꤵ?줿?????? 0
?˥ꥻ?åȤ??ޤ????????ϥꥻ?åȤ???????
PMIOSTOP
?ˤ??????ߤ????ʤ????Фʤ??ޤ????????ƤΥ????ϼ?ưŪ??
PMIOSETUP
?ˤ??äƥꥻ?åȤ????ޤ???
PMIOREAD
- (
struct pmc_data
)
?????θ??ߤ??ͤ??????Ф??ޤ???
pmc_data
??¤?Τˤϼ??Τ褦?? 2
?ĤΥե??????ɤ??????????Ƥ??ޤ?:
int
pmcd_num
- ?ɤ߽Ф????????ֹ档
int
pmcd_value
- 64
?ӥåȤ??????դ??????Ǥν?λ?͡?
???衢 Pentium Pro ?ץ????å?????
??????ľ???ɤ߽Ф??٤?
RDPMC
̿???????ѽ??????ͤˤʤ??Ǥ??礦??
PMIOTSTAMP
- (
struct pmc_tstamp
)
?????ॹ?????ץ??????ɤ߽Ф??ޤ???
pmc_tstamp
??¤?ΤǤ? 2
?ĤΥե??????ɤ??????????Ƥ??ޤ?:
int
pmct_rate
- ?????? MHz
?ǤΤ????褽??®?٤Ǥ???
quad_t
pmct_value
- 64
?ӥå??????ǤΥ????θ??ߤ??ͤǤ???
pmct_rate
?ե??????ɤ?Ϳ???????륫????®?٤ϡ?
???????????ʻ??䥯???å??οʹԤ??Դ????ʰ٤ˡ?
?????ˤ??????ΤǤϤʤ????Ȥ????դ??????????ڤǤ???
???Υե??????ɤˤĤ??Ƥ?
?????å???????®?٤??ºݤ?ɽ?????????ΤȤ?????????
?꤬???꤫????Ŭ?????θ??????餤?˹ͤ????٤??Ǥ???
- /dev/perfmon
- ?????ؤ?ʸ?????ǥХ????Υ??ե?????
- /usr/include/machine/perfmon.h
- ??¤?Τȥ??٥??ȥ????ɤ????????Ƥ??륤?롼?ɥե?????
- /usr/share/examples/perfmon
- ???Ƥ?
ioctl
()
???ޥ??ɤλ??Ѥ?????Ū???㼨?????????ץ??Υ???????????
ioctl(2)
Intel Corporation,
Pentium Pro Family Developer's Manual,
vol. 3, January 1996,
Operating System Writer's Manual.
?????ƥ른???ѥ?????????,
Pentium Pro ?ե??ߥ
?ǥ??٥??åѡ??? ?ޥ˥奢??,
????, January 1996,
???ڥ졼?ƥ????? ?????ƥ?
?饤?????? ?ޥ˥奢??.
perfmon
?ǥХ????? FreeBSD
2.2 ?ǽ????Ƹ????ޤ?????
perfmon
?ɥ饤?Ф?
Garrett A. Wollman, MIT Laboratory for Computer
Science ???ޤ?????