Skip to content

Commit

Permalink
Fix conditions for determining whether an event is included
Browse files Browse the repository at this point in the history
Signed-off-by: zeroalphat <taichi-takemura@cybozu.co.jp>
  • Loading branch information
zeroalphat committed Oct 16, 2023
1 parent 2da88b6 commit 94620db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const (
ScriptSubcommand = "script"
ProfilingFileName = "perf.data"
ScriptFileName = "perf.script"
CpuEvent = "cpu-clock:pppH:"
CpuClockEvent = "cpu-clock:"
CyclesEvent = "cycles:"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/resource/perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (p *PerfExecuter) GetEvent(ctx context.Context, path string) (*bytes.Buffer

// Check if events are contained in the perf.data file.
func (p *PerfExecuter) HasPerfEvent(ctx context.Context, buf *bytes.Buffer) bool {
return strings.Contains(buf.String(), constants.CpuEvent)
return strings.Contains(buf.String(), constants.CyclesEvent) || strings.Contains(buf.String(), constants.CpuClockEvent)
}

func (p *PerfExecuter) ExecScript(ctx context.Context, path, workDir string) (string, error) {
Expand Down

0 comments on commit 94620db

Please sign in to comment.