feat(profiler): add flags to make it easier to enable collection of different profile types
@@ -38,6 +38,10 @@ var (
numReqs = flag.Int("num_requests", 20, "number of requests to simulate")
concurrency = flag.Int("concurrency", 1, "number of requests to run in parallel")
numRounds = flag.Int("num_rounds", 0, "number of simulation rounds (0 for infinite)")
+ enableHeap = flag.Bool("heap", false, "enable heap profile collection")
+ enableHeapAlloc = flag.Bool("heap_alloc", false, "enable heap allocation profile collection")
+ enableThread = flag.Bool("thread", false, "enable thread profile collection")
+ enableContention = flag.Bool("contention", false, "enable contention profile collection")
)
func main() {
@@ -47,9 +51,10 @@ func main() {
Service: "shakesapp",
ServiceVersion: *version,
ProjectID: *projectID,
- NoHeapProfiling: true,
- NoAllocProfiling: true,
- NoGoroutineProfiling: true,
+ NoHeapProfiling: !*enableHeap,
+ NoAllocProfiling: !*enableHeapAlloc,
+ NoGoroutineProfiling: !*enableThread,
+ MutexProfiling: *enableContention,
DebugLogging: true,
}); err != nil {
log.Fatalf("Failed to start profiler: %v", err)
