Skip to contentSkip to conversation

perf sched: simplify if-if to if-else

PATCH In review Wan Jiabing 2 participants 2 messages Apr 24, 2022 – Apr 25, 2022 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf sched: simplify if-if to if-else

Use if and else instead of if(A) and if (!A).

---
 tools/perf/builtin-sched.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/builtin-sched.c +1 -2
index 646bd938927a..66f8e9318123 100644
@@ -3070,8 +3070,7 @@ static int perf_sched__timehist(struct perf_sched *sched)
 	/* summary_only implies summary option, but don't overwrite summary if set */
 	if (sched->summary_only)
 		sched->summary = sched->summary_only;
-
-	if (!sched->summary_only)
+	else
 		timehist_header(sched);
 
 	err = perf_session__process_events(session);
Signature · 1 line
2.35.1
#1 lore raw

Em Sun, Apr 24, 2022 at 05:07:27PM +0800, Wan Jiabing escreveu:

Quoted 1 line

Use if and else instead of if(A) and if (!A).

I'm now looking for a brown paper bag... There is some hope, but I'm not in a mood, will check tomorrow, but certainly this should go in, thanks!

- Arnaldo

Quoted 21 lines
---
 tools/perf/builtin-sched.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/builtin-sched.c +1 -2
index 646bd938927a..66f8e9318123 100644
@@ -3070,8 +3070,7 @@ static int perf_sched__timehist(struct perf_sched *sched)
 	/* summary_only implies summary option, but don't overwrite summary if set */
 	if (sched->summary_only)
 		sched->summary = sched->summary_only;
-
-	if (!sched->summary_only)
+	else
 		timehist_header(sched);
 
 	err = perf_session__process_events(session);
Signature · 1 line
2.35.1
Signature · 1 line
- Arnaldo