Skip to content
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
5 changes: 3 additions & 2 deletions cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,14 @@ func runCmd(cmd *cobra.Command, args []string) error {
if cmd.Parent().PersistentFlags().Lookup("debug").Value.String() != "true" {
for _, myTarget := range myTargets {
if myTarget.GetTempDirectory() != "" {
defer func() {
deferTarget := myTarget // create a new variable to capture the current value
defer func(deferTarget target.Target) {
err = myTarget.RemoveTempDirectory()
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to remove target temp directory: %+v\n", err)
slog.Error(err.Error())
}
}()
}(deferTarget)
}
}
}
Expand Down
26 changes: 19 additions & 7 deletions cmd/flame/flame.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ var Cmd = &cobra.Command{
}

var (
flagDuration int
flagFrequency int
flagPid int
flagDuration int
flagFrequency int
flagPid int
flagNoSystemSummary bool
)

const (
flagDurationName = "duration"
flagFrequencyName = "frequency"
flagPidName = "pid"
flagDurationName = "duration"
flagFrequencyName = "frequency"
flagPidName = "pid"
flagNoSystemSummaryName = "no-summary"
)

func init() {
Expand All @@ -55,6 +57,7 @@ func init() {
Cmd.Flags().IntVar(&flagDuration, flagDurationName, 30, "")
Cmd.Flags().IntVar(&flagFrequency, flagFrequencyName, 11, "")
Cmd.Flags().IntVar(&flagPid, flagPidName, 0, "")
Cmd.Flags().BoolVar(&flagNoSystemSummary, flagNoSystemSummaryName, false, "")

common.AddTargetFlags(Cmd)

Expand Down Expand Up @@ -105,6 +108,10 @@ func getFlagGroups() []common.FlagGroup {
Name: common.FlagFormatName,
Help: fmt.Sprintf("choose output format(s) from: %s", strings.Join(append([]string{report.FormatAll}, report.FormatHtml, report.FormatTxt, report.FormatJson), ", ")),
},
{
Name: flagNoSystemSummaryName,
Help: "do not include system summary table in report",
},
}
groups = append(groups, common.FlagGroup{
GroupName: "Options",
Expand Down Expand Up @@ -166,6 +173,11 @@ func validateFlags(cmd *cobra.Command, args []string) error {
}

func runCmd(cmd *cobra.Command, args []string) error {
var tableNames []string
if !flagNoSystemSummary {
tableNames = append(tableNames, report.BriefSysSummaryTableName)
}
tableNames = append(tableNames, report.CodePathFrequencyTableName)
reportingCommand := common.ReportingCommand{
Cmd: cmd,
ReportNamePost: "flame",
Expand All @@ -174,7 +186,7 @@ func runCmd(cmd *cobra.Command, args []string) error {
"Duration": strconv.Itoa(flagDuration),
"PID": strconv.Itoa(flagPid),
},
TableNames: []string{report.CodePathFrequencyTableName},
TableNames: tableNames,
}
return reportingCommand.Run()
}
28 changes: 20 additions & 8 deletions cmd/lock/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@ var Cmd = &cobra.Command{
}

var (
flagDuration int
flagFrequency int
flagPackage bool
flagFormat []string
flagDuration int
flagFrequency int
flagPackage bool
flagFormat []string
flagNoSystemSummary bool
)

const (
flagDurationName = "duration"
flagFrequencyName = "frequency"
flagPackageName = "package"
flagDurationName = "duration"
flagFrequencyName = "frequency"
flagPackageName = "package"
flagNoSystemSummaryName = "no-summary"
)

func init() {
Expand All @@ -58,6 +60,7 @@ func init() {
Cmd.Flags().IntVar(&flagDuration, flagDurationName, 10, "")
Cmd.Flags().IntVar(&flagFrequency, flagFrequencyName, 11, "")
Cmd.PersistentFlags().BoolVar(&flagPackage, flagPackageName, false, "")
Cmd.Flags().BoolVar(&flagNoSystemSummary, flagNoSystemSummaryName, false, "")

common.AddTargetFlags(Cmd)

Expand Down Expand Up @@ -108,6 +111,10 @@ func getFlagGroups() []common.FlagGroup {
Name: common.FlagFormatName,
Help: fmt.Sprintf("choose output format(s) from: %s", strings.Join(append([]string{report.FormatAll}, report.FormatHtml, report.FormatTxt), ", ")),
},
{
Name: flagNoSystemSummaryName,
Help: "do not include system summary table in report",
},
}
groups = append(groups, common.FlagGroup{
GroupName: "Options",
Expand Down Expand Up @@ -186,6 +193,11 @@ func pullDataFiles(appContext common.AppContext, scriptOutputs map[string]script
}

func runCmd(cmd *cobra.Command, args []string) error {
var tableNames []string
if !flagNoSystemSummary {
tableNames = append(tableNames, report.BriefSysSummaryTableName)
}
tableNames = append(tableNames, report.KernelLockAnalysisTableName)
reportingCommand := common.ReportingCommand{
Cmd: cmd,
ReportNamePost: "lock",
Expand All @@ -194,7 +206,7 @@ func runCmd(cmd *cobra.Command, args []string) error {
"Duration": strconv.Itoa(flagDuration),
"Package": strconv.FormatBool(flagPackage),
},
TableNames: []string{report.KernelLockAnalysisTableName},
TableNames: tableNames,
}

// only try to download package when option specified
Expand Down
Loading