-
Notifications
You must be signed in to change notification settings - Fork 399
Amend -off-cpu-threshold value #316
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cde27ac
Amend -off-cpu-threshold value
rockdaboot d138130
Fix typo
rockdaboot ceb5dfd
Add arm64 ebpf blob
rockdaboot 00ec29b
Drop promise to report all off-cpu events
rockdaboot 238aa3d
Fix linter
rockdaboot ecd3267
Amend help text
rockdaboot db2d91b
Fix typo
rockdaboot c69a3c2
Update cli_flags.go
rockdaboot f11d311
Rephrase off-cpu help text
rockdaboot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -490,7 +490,7 @@ func initializeMapsAndPrograms(kernelSymbols *libpf.SymbolMap, cfg *Config) ( | |
| return nil, nil, fmt.Errorf("failed to load perf eBPF programs: %v", err) | ||
| } | ||
|
|
||
| if cfg.OffCPUThreshold < support.OffCPUThresholdMax { | ||
| if cfg.OffCPUThreshold > 0 { | ||
| if err = loadKProbeUnwinders(coll, ebpfProgs, ebpfMaps["kprobe_progs"], tailCallProgs, | ||
| cfg.BPFVerifierLogLevel, ebpfMaps["perf_progs"].FD()); err != nil { | ||
| return nil, nil, fmt.Errorf("failed to load kprobe eBPF programs: %v", err) | ||
|
|
@@ -554,23 +554,22 @@ func loadAllMaps(coll *cebpf.CollectionSpec, cfg *Config, | |
| // On modern systems /proc/sys/kernel/pid_max defaults to 4194304. | ||
| // Try to fit this PID space scaled down with cfg.OffCPUThreshold into | ||
| // this map. | ||
| adaption["sched_times"] = (4194304 / support.OffCPUThresholdMax) * cfg.OffCPUThreshold | ||
| adaption["sched_times"] = (4194304 * cfg.OffCPUThreshold) / support.OffCPUThresholdMax | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Multiply first to prevent rounding inaccuracies.
rockdaboot marked this conversation as resolved.
|
||
|
|
||
| for i := support.StackDeltaBucketSmallest; i <= support.StackDeltaBucketLargest; i++ { | ||
| mapName := fmt.Sprintf("exe_id_to_%d_stack_deltas", i) | ||
| adaption[mapName] = 1 << uint32(exeIDToStackDeltasSize+cfg.MapScaleFactor) | ||
| } | ||
|
|
||
| for mapName, mapSpec := range coll.Maps { | ||
| if mapName == "sched_times" && cfg.OffCPUThreshold == 0 { | ||
| // Off CPU Profiling is disabled. So do not load this map. | ||
| continue | ||
| } | ||
| if newSize, ok := adaption[mapName]; ok { | ||
| log.Debugf("Size of eBPF map %s: %v", mapName, newSize) | ||
| mapSpec.MaxEntries = newSize | ||
| } | ||
| if mapName == "sched_times" && | ||
| cfg.OffCPUThreshold >= support.OffCPUThresholdMax { | ||
| // Off CPU Profiling is not enabled. So do not load this map. | ||
| continue | ||
| } | ||
| ebpfMap, err := cebpf.NewMap(mapSpec) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to load %s: %v", mapName, err) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.