test: perf: prevent overflow counter from stopping counter
Fixes: 1a204b6 "perf: overflow test"
Change-Id: I4d8e93b97f7a8d58ef7811f55b5c995b16c5af69
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
/* combination_test.c COPYRIGHT FUJITSU LIMITED 2019 */
|
||||
#include "combination_test.h"
|
||||
#include "perf_common.h"
|
||||
|
||||
//
|
||||
// main
|
||||
@ -32,6 +33,31 @@ static int combination_test(struct command_set *cmd_set)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Set reasonable value to overflow counter so as not to stop
|
||||
* counter on Linux. Reset must precede to prevent
|
||||
* uninitialized value is accumulated on McKernel for the case
|
||||
* REFRESH includes ENABLE
|
||||
*/
|
||||
ret = perf_event_ioc_refresh(fd, NULL);
|
||||
if (ret < 0) {
|
||||
perror("perf_event_ioc_refresh");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Stop counter for the case REFRESH includes ENABLE */
|
||||
ret = asm_ioctl3(fd, PERF_EVENT_IOC_DISABLE, 0);
|
||||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
perror("asm_ioctl(PERF_EVENT_IOC_DISABLE)");
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ioctl(fd, PERF_EVENT_IOC_RESET, 0);
|
||||
if (ret < 0) {
|
||||
perror("ioctl(PERF_EVENT_IOC_RESET)");
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = asm_ioctl3(fd, PERF_EVENT_IOC_ENABLE, 0);
|
||||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
|
||||
Reference in New Issue
Block a user