-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e935c8
commit 21a3238
Showing
5 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
#include <assert.h> | ||
#include <math.h> | ||
#include "cacheutils.h" | ||
#include "./../libpmu/pmu.h" | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
PMU_EVENT pe0 = { | ||
.event_code = 0xD1, | ||
.umask = 0x08, | ||
.user_mode = 1, | ||
.os = 0, | ||
.edge_detect = 0, | ||
.pc = 0, | ||
.int_enable = 0, | ||
.enable_couters = 1, | ||
.invert = 0, | ||
.counter_mask = 0, | ||
}; // MEM_LOAD_RETIRED.L1_MISS | ||
|
||
uint64_t hexcode = pmu_event_to_hexcode(&pe0); | ||
|
||
int msr_fd = pmu_open_msr(0), core = 0, pmu_id = 0; | ||
|
||
pmu_set_event(core, &msr_fd, hexcode, pmu_id); | ||
|
||
pmu_set_msr_event(msr_fd, hexcode, pmu_id); | ||
|
||
pmu_set_pmc(msr_fd, pmu_id, 0); | ||
|
||
pmu_record_start(msr_fd); | ||
|
||
uint64_t pmu_val_msr = pmu_get_MSR_pmc(msr_fd, pmu_id); | ||
|
||
uint64_t pmu_val = pmu_get_rdpmc(pmu_id); | ||
|
||
uint64_t msrs_num = pmu_get_MSRs_num(); | ||
|
||
uint64_t pmc_bit_width = pmu_get_PMC_bit_width(); | ||
|
||
pmu_record_stop(msr_fd); | ||
|
||
printf("pmu-utils all test function passed\n"); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters