openEuler: perf tools: add perf_evlist__terminate() for terminate
OpenAnolis Bug Tracker: 0000573 commit 2f9c0452ca4406b9b83bafe4ab82b4ff7888dd21 openEuler In __cmd_record(), when receiving SIGINT(ctrl + c), a done flag will be set and the event list will be disabled by perf_evlist__disable() once. While in auxtrace_record.read_finish(), the related events will be enabled again, if they are continuous, the recording seems to be endless. Mark the evlist's state as terminated, preparing for the following fix. Signed-off-by: Wei Li <liwei391@huawei.com> Reviewed-by: Xuefeng Wang <wxf.wang@hisilicon.com> Reviewed-by: Tan Xiaojun <tanxiaojun@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Xin Hao <xhao@linux.alibaba.com> Reviewed-by: luanshi <zhangliguang@linux.alibaba.com> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
This commit is contained in:
parent
61ac1412a3
commit
f4bacd4af2
|
@ -1133,6 +1133,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
|
|||
if (done && !disabled && !target__none(&opts->target)) {
|
||||
trigger_off(&auxtrace_snapshot_trigger);
|
||||
perf_evlist__disable(rec->evlist);
|
||||
perf_evlist__terminate(rec->evlist);
|
||||
disabled = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,6 +357,20 @@ static int perf_evlist__nr_threads(struct perf_evlist *evlist,
|
|||
return thread_map__nr(evlist->threads);
|
||||
}
|
||||
|
||||
void perf_evlist__terminate(struct perf_evlist *evlist)
|
||||
{
|
||||
struct perf_evsel *pos;
|
||||
|
||||
evlist__for_each_entry(evlist, pos) {
|
||||
if (!perf_evsel__is_group_leader(pos) || !pos->fd)
|
||||
continue;
|
||||
perf_evsel__disable(pos);
|
||||
pos->terminated = true;
|
||||
}
|
||||
|
||||
evlist->enabled = false;
|
||||
}
|
||||
|
||||
void perf_evlist__disable(struct perf_evlist *evlist)
|
||||
{
|
||||
struct perf_evsel *pos;
|
||||
|
|
|
@ -168,6 +168,7 @@ void perf_evlist__munmap(struct perf_evlist *evlist);
|
|||
|
||||
size_t perf_evlist__mmap_size(unsigned long pages);
|
||||
|
||||
void perf_evlist__terminate(struct perf_evlist *evlist);
|
||||
void perf_evlist__disable(struct perf_evlist *evlist);
|
||||
void perf_evlist__enable(struct perf_evlist *evlist);
|
||||
void perf_evlist__toggle_enable(struct perf_evlist *evlist);
|
||||
|
|
|
@ -146,6 +146,7 @@ struct perf_evsel {
|
|||
bool collect_stat;
|
||||
bool weak_group;
|
||||
const char *pmu_name;
|
||||
bool terminated;
|
||||
};
|
||||
|
||||
union u64_swap {
|
||||
|
|
Loading…
Reference in New Issue