Skip to content

Commit

Permalink
Remove redeclaration of unix package
Browse files Browse the repository at this point in the history
Signed-off-by: Wisniewski, Krzysztof2 <[email protected]>
  • Loading branch information
kwisniewski98 committed Apr 22, 2021
1 parent 54abc69 commit 7179a92
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions perf/collector_libpfm.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (c *collector) setup() error {

leaderFileDescriptors, err := c.createLeaderFileDescriptors(group.events, cgroupFd, groupIndex, leaderFileDescriptors)
if err != nil {
klog.Error(err)
klog.Errorf("Cannot count perf event group %v: %v", group.events, err)
c.deleteGroup(groupIndex)
continue
} else {
Expand Down Expand Up @@ -232,7 +232,7 @@ func (c *collector) createLeaderFileDescriptors(events []Event, cgroupFd int, gr
config := c.createConfigFromRawEvent(customEvent)
leaderFileDescriptors, err = c.registerEvent(eventInfo{string(customEvent.Name), config, cgroupFd, groupIndex, isGroupLeader}, leaderFileDescriptors)
if err != nil {
return nil, fmt.Errorf("cannot to register perf event: %v", err)
return nil, fmt.Errorf("cannot register perf event: %v", err)
}
} else {
config, err := c.createConfigFromEvent(event)
Expand All @@ -242,7 +242,7 @@ func (c *collector) createLeaderFileDescriptors(events []Event, cgroupFd int, gr
}
leaderFileDescriptors, err = c.registerEvent(eventInfo{string(event), config, cgroupFd, groupIndex, isGroupLeader}, leaderFileDescriptors)
if err != nil {
return nil, fmt.Errorf("cannot to register perf event: %v", err)
return nil, fmt.Errorf("cannot register perf event: %v", err)
}
// Clean memory allocated by C code.
C.free(unsafe.Pointer(config))
Expand Down
2 changes: 0 additions & 2 deletions perf/collector_libpfm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (

"golang.org/x/sys/unix"

"golang.org/x/sys/unix"

"github.com/stretchr/testify/assert"

info "github.com/google/cadvisor/info/v1"
Expand Down
1 change: 1 addition & 0 deletions perf/uncore_libpfm.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ func (c *uncoreCollector) setupRawEvent(event *CustomEvent, pmus uncorePMUs, gro

return nil
}

func (c *uncoreCollector) deleteGroup(groupIndex int) {
groupPMUs := c.cpuFiles[groupIndex]
for pmu, group := range groupPMUs {
Expand Down

0 comments on commit 7179a92

Please sign in to comment.