Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove exclude guest flag from perf event attrs. #2640

Merged
merged 1 commit into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion perf/collector_libpfm.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func createPerfEventAttr(event CustomEvent) *unix.PerfEventAttr {
func setAttributes(config *unix.PerfEventAttr, leader bool) {
config.Sample_type = unix.PERF_SAMPLE_IDENTIFIER
config.Read_format = unix.PERF_FORMAT_TOTAL_TIME_ENABLED | unix.PERF_FORMAT_TOTAL_TIME_RUNNING | unix.PERF_FORMAT_GROUP | unix.PERF_FORMAT_ID
config.Bits = unix.PerfBitInherit | unix.PerfBitExcludeGuest
config.Bits = unix.PerfBitInherit

// Group leader should have this flag set to disable counting until all group would be prepared.
if leader {
Expand Down
4 changes: 2 additions & 2 deletions perf/collector_libpfm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ func TestSetGroupAttributes(t *testing.T) {
setAttributes(attributes, true)
assert.Equal(t, uint64(65536), attributes.Sample_type)
assert.Equal(t, uint64(0xf), attributes.Read_format)
assert.Equal(t, uint64(0x100003), attributes.Bits)
assert.Equal(t, uint64(0x3), attributes.Bits)

attributes = createPerfEventAttr(event)
setAttributes(attributes, false)
assert.Equal(t, uint64(65536), attributes.Sample_type)
assert.Equal(t, uint64(0xf), attributes.Read_format)
assert.Equal(t, uint64(0x100002), attributes.Bits)
assert.Equal(t, uint64(0x2), attributes.Bits)
}

func TestNewCollector(t *testing.T) {
Expand Down