Skip to contentSkip to conversation

perf report: Fix input reload/switch functionality

PATCH Applied Dmitry Vyukov 3 participants 9 messages Jan 8, 2025 – Feb 20, 2025 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf report: Fix input reload/switch functionality

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Fixes ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol")
Cc Namhyung Kim <[email protected]>
Cc Ian Rogers <[email protected]>
---
 tools/perf/builtin-report.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
tools/perf/builtin-report.c +16 -14
index 048c91960ba91..42d7dfdf07d9b 100644
@@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv)
 		symbol_conf.annotate_data_sample = true;
 	}
 
-	if (sort_order && strstr(sort_order, "ipc")) {
-		parse_options_usage(report_usage, options, "s", 1);
-		goto error;
-	}
-
-	if (sort_order && strstr(sort_order, "symbol")) {
-		if (sort__mode == SORT_MODE__BRANCH) {
-			snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-				 sort_order, "ipc_lbr");
-			report.symbol_ipc = true;
-		} else {
-			snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-				 sort_order, "ipc_null");
+	if (last_key != K_SWITCH_INPUT_DATA) {
+		if (sort_order && strstr(sort_order, "ipc")) {
+			parse_options_usage(report_usage, options, "s", 1);
+			goto error;
 		}
 
-		sort_order = sort_tmp;
+		if (sort_order && strstr(sort_order, "symbol")) {
+			if (sort__mode == SORT_MODE__BRANCH) {
+				snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+					 sort_order, "ipc_lbr");
+				report.symbol_ipc = true;
+			} else {
+				snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+					 sort_order, "ipc_null");
+			}
+
+			sort_order = sort_tmp;
+		}
 	}
 
 	if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&

base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780

Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
reviewer
#1 lore raw
Quoted 5 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Hi Dmitry,

A reproducer with before and after behavior might be helpful for the review.

It might be unrelated to your change here, but the input switch thing didn't seem to do anything for me. If I record two files, open the first one, press S and select the second file nothing seems to change. I assumed it would show the other file but nothing changes?

 $ perf record -- true
 $ perf record -o 2.data -- ls
 $ perf report
 S key
 load 2.data
Quoted 54 lines
Fixes ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol")
Cc Namhyung Kim <[email protected]>> Cc: Ian Rogers <[email protected]>
---
  tools/perf/builtin-report.c | 30 ++++++++++++++++--------------
  1 file changed, 16 insertions(+), 14 deletions(-)
tools/perf/builtin-report.c +16 -14
index 048c91960ba91..42d7dfdf07d9b 100644
@@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv)
  		symbol_conf.annotate_data_sample = true;
  	}
 
-	if (sort_order && strstr(sort_order, "ipc")) {
-		parse_options_usage(report_usage, options, "s", 1);
-		goto error;
-	}
-
-	if (sort_order && strstr(sort_order, "symbol")) {
-		if (sort__mode == SORT_MODE__BRANCH) {
-			snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-				 sort_order, "ipc_lbr");
-			report.symbol_ipc = true;
-		} else {
-			snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-				 sort_order, "ipc_null");
+	if (last_key != K_SWITCH_INPUT_DATA) {
+		if (sort_order && strstr(sort_order, "ipc")) {
+			parse_options_usage(report_usage, options, "s", 1);
+			goto error;
  		}
 
-		sort_order = sort_tmp;
+		if (sort_order && strstr(sort_order, "symbol")) {
+			if (sort__mode == SORT_MODE__BRANCH) {
+				snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+					 sort_order, "ipc_lbr");
+				report.symbol_ipc = true;
+			} else {
+				snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+					 sort_order, "ipc_null");
+			}
+
+			sort_order = sort_tmp;
+		}
  	}
 
  	if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&

base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780

#2 lore raw
Quoted 17 lines · James Clark
Quoted 5 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Hi Dmitry,

A reproducer with before and after behavior might be helpful for the review.

It might be unrelated to your change here, but the input switch thing didn't seem to do anything for me. If I record two files, open the first one, press S and select the second file nothing seems to change. I assumed it would show the other file but nothing changes?

Quoted 5 lines
  $ perf record -- true
  $ perf record -o 2.data -- ls
  $ perf report
  S key
  load 2.data

Yes, sure. This needs "--sort symbol":

perf report --sort symbol

then press 's', select file, and it terminates.

Affects fewer cases then I initially assumed, since I happened to run with "--sort symbol" when I discovered it.

Quoted 56 lines
Quoted 3 lines
Fixes ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol")
Cc Namhyung Kim <[email protected]>> Cc: Ian Rogers

<[email protected]>

Quoted 51 lines
---
  tools/perf/builtin-report.c | 30 ++++++++++++++++--------------
  1 file changed, 16 insertions(+), 14 deletions(-)
tools/perf/builtin-report.c +16 -14
index 048c91960ba91..42d7dfdf07d9b 100644
@@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv)
              symbol_conf.annotate_data_sample = true;
      }
 
-     if (sort_order && strstr(sort_order, "ipc")) {
-             parse_options_usage(report_usage, options, "s", 1);
-             goto error;
-     }
-
-     if (sort_order && strstr(sort_order, "symbol")) {
-             if (sort__mode == SORT_MODE__BRANCH) {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_lbr");
-                     report.symbol_ipc = true;
-             } else {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_null");
+     if (last_key != K_SWITCH_INPUT_DATA) {
+             if (sort_order && strstr(sort_order, "ipc")) {
+                     parse_options_usage(report_usage, options, "s", 1);
+                     goto error;
              }
 
-             sort_order = sort_tmp;
+             if (sort_order && strstr(sort_order, "symbol")) {
+                     if (sort__mode == SORT_MODE__BRANCH) {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_lbr");
+                             report.symbol_ipc = true;
+                     } else {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_null");
+                     }
+
+                     sort_order = sort_tmp;
+             }
      }
 
      if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&

base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780

reviewer
#3 lore raw
Quoted 24 lines · Dmitry Vyukov
Quoted 17 lines · James Clark
Quoted 5 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Hi Dmitry,

A reproducer with before and after behavior might be helpful for the review.

It might be unrelated to your change here, but the input switch thing didn't seem to do anything for me. If I record two files, open the first one, press S and select the second file nothing seems to change. I assumed it would show the other file but nothing changes?

Quoted 5 lines
   $ perf record -- true
   $ perf record -o 2.data -- ls
   $ perf report
   S key
   load 2.data
Quoted 10 lines

Yes, sure. This needs "--sort symbol":

perf report --sort symbol

then press 's', select file, and it terminates.

Affects fewer cases then I initially assumed, since I happened to run with "--sort symbol" when I discovered it.

Ah yeah I can reproduce the bug with --sort, which is fixed by the patch. But 's' doesn't actually reload a new histogram for me, I just get the original file again. Maybe I'm misunderstanding what 's' is supposed to do?

Quoted 56 lines
Quoted 56 lines
Quoted 3 lines
Fixes ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol")
Cc Namhyung Kim <[email protected]>> Cc: Ian Rogers

<[email protected]>

Quoted 51 lines
---
   tools/perf/builtin-report.c | 30 ++++++++++++++++--------------
   1 file changed, 16 insertions(+), 14 deletions(-)
tools/perf/builtin-report.c +16 -14
index 048c91960ba91..42d7dfdf07d9b 100644
@@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv)
               symbol_conf.annotate_data_sample = true;
       }
 
-     if (sort_order && strstr(sort_order, "ipc")) {
-             parse_options_usage(report_usage, options, "s", 1);
-             goto error;
-     }
-
-     if (sort_order && strstr(sort_order, "symbol")) {
-             if (sort__mode == SORT_MODE__BRANCH) {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_lbr");
-                     report.symbol_ipc = true;
-             } else {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_null");
+     if (last_key != K_SWITCH_INPUT_DATA) {
+             if (sort_order && strstr(sort_order, "ipc")) {
+                     parse_options_usage(report_usage, options, "s", 1);
+                     goto error;
               }
 
-             sort_order = sort_tmp;
+             if (sort_order && strstr(sort_order, "symbol")) {
+                     if (sort__mode == SORT_MODE__BRANCH) {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_lbr");
+                             report.symbol_ipc = true;
+                     } else {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_null");
+                     }
+
+                     sort_order = sort_tmp;
+             }
       }
 
       if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&

base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780

#4 lore raw
Quoted 36 lines · James Clark
Quoted 24 lines · Dmitry Vyukov
Quoted 17 lines · James Clark
Quoted 5 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Hi Dmitry,

A reproducer with before and after behavior might be helpful for the review.

It might be unrelated to your change here, but the input switch thing didn't seem to do anything for me. If I record two files, open the first one, press S and select the second file nothing seems to change. I assumed it would show the other file but nothing changes?

Quoted 5 lines
   $ perf record -- true
   $ perf record -o 2.data -- ls
   $ perf report
   S key
   load 2.data
Quoted 10 lines

Yes, sure. This needs "--sort symbol":

perf report --sort symbol

then press 's', select file, and it terminates.

Affects fewer cases then I initially assumed, since I happened to run with "--sort symbol" when I discovered it.

Quoted 4 lines

Ah yeah I can reproduce the bug with --sort, which is fixed by the patch. But 's' doesn't actually reload a new histogram for me, I just get the original file again. Maybe I'm misunderstanding what 's' is supposed to do?

As far as I understand, 's' allows you to select and load a new profile w/o existing (fwiw, if you select a different file). If the file has changed, I guess you can also reload it and see the changes.

Quoted 57 lines
Quoted 56 lines
Quoted 56 lines
Quoted 3 lines
Fixes ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol")
Cc Namhyung Kim <[email protected]>> Cc: Ian Rogers

<[email protected]>

Quoted 51 lines
---
   tools/perf/builtin-report.c | 30 ++++++++++++++++--------------
   1 file changed, 16 insertions(+), 14 deletions(-)
tools/perf/builtin-report.c +16 -14
index 048c91960ba91..42d7dfdf07d9b 100644
@@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv)
               symbol_conf.annotate_data_sample = true;
       }
 
-     if (sort_order && strstr(sort_order, "ipc")) {
-             parse_options_usage(report_usage, options, "s", 1);
-             goto error;
-     }
-
-     if (sort_order && strstr(sort_order, "symbol")) {
-             if (sort__mode == SORT_MODE__BRANCH) {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_lbr");
-                     report.symbol_ipc = true;
-             } else {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_null");
+     if (last_key != K_SWITCH_INPUT_DATA) {
+             if (sort_order && strstr(sort_order, "ipc")) {
+                     parse_options_usage(report_usage, options, "s", 1);
+                     goto error;
               }
 
-             sort_order = sort_tmp;
+             if (sort_order && strstr(sort_order, "symbol")) {
+                     if (sort__mode == SORT_MODE__BRANCH) {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_lbr");
+                             report.symbol_ipc = true;
+                     } else {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_null");
+                     }
+
+                     sort_order = sort_tmp;
+             }
       }
 
       if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&

base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780

reviewer
#5 lore raw
Quoted 37 lines · Dmitry Vyukov
Quoted 36 lines · James Clark
Quoted 34 lines · Dmitry Vyukov
Quoted 17 lines · James Clark
Quoted 5 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Hi Dmitry,

A reproducer with before and after behavior might be helpful for the review.

It might be unrelated to your change here, but the input switch thing didn't seem to do anything for me. If I record two files, open the first one, press S and select the second file nothing seems to change. I assumed it would show the other file but nothing changes?

Quoted 5 lines
    $ perf record -- true
    $ perf record -o 2.data -- ls
    $ perf report
    S key
    load 2.data

Yes, sure. This needs "--sort symbol":

perf report --sort symbol

then press 's', select file, and it terminates.

Affects fewer cases then I initially assumed, since I happened to run with "--sort symbol" when I discovered it.

Quoted 7 lines
Quoted 4 lines

Ah yeah I can reproduce the bug with --sort, which is fixed by the patch. But 's' doesn't actually reload a new histogram for me, I just get the original file again. Maybe I'm misunderstanding what 's' is supposed to do?

As far as I understand, 's' allows you to select and load a new profile w/o existing (fwiw, if you select a different file). If the

By 'without existing' do you mean running perf report with no perf.data file? It won't run like that it just says "failed to open perf.data"

Quoted 2 lines

file has changed, I guess you can also reload it and see the changes.

I wasn't able to make that work. How do you reload? If I change screen between different events I still get the old file and I didn't see 'reload' mentioned in the keybinding popup.

I suppose my point is maybe it's not worth fixing the sort order bug if we can just remove input file switching. The behavior doesn't seem any different to v5.8 in case its a regression. Maybe I'm just doing something wrong though.

Quoted 58 lines
Quoted 58 lines
Quoted 57 lines
Quoted 57 lines
Quoted 4 lines
Fixes ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol")
Cc Namhyung Kim <[email protected]>> Cc: Ian Rogers

<[email protected]>

Quoted 51 lines
---
    tools/perf/builtin-report.c | 30 ++++++++++++++++--------------
    1 file changed, 16 insertions(+), 14 deletions(-)
tools/perf/builtin-report.c +16 -14
index 048c91960ba91..42d7dfdf07d9b 100644
@@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv)
                symbol_conf.annotate_data_sample = true;
        }
 
-     if (sort_order && strstr(sort_order, "ipc")) {
-             parse_options_usage(report_usage, options, "s", 1);
-             goto error;
-     }
-
-     if (sort_order && strstr(sort_order, "symbol")) {
-             if (sort__mode == SORT_MODE__BRANCH) {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_lbr");
-                     report.symbol_ipc = true;
-             } else {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_null");
+     if (last_key != K_SWITCH_INPUT_DATA) {
+             if (sort_order && strstr(sort_order, "ipc")) {
+                     parse_options_usage(report_usage, options, "s", 1);
+                     goto error;
                }
 
-             sort_order = sort_tmp;
+             if (sort_order && strstr(sort_order, "symbol")) {
+                     if (sort__mode == SORT_MODE__BRANCH) {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_lbr");
+                             report.symbol_ipc = true;
+                     } else {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_null");
+                     }
+
+                     sort_order = sort_tmp;
+             }
        }
 
        if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&

base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780

#6 lore raw
Quoted 53 lines · James Clark
Quoted 37 lines · Dmitry Vyukov
Quoted 36 lines · James Clark
Quoted 34 lines · Dmitry Vyukov
Quoted 17 lines · James Clark
Quoted 5 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Hi Dmitry,

A reproducer with before and after behavior might be helpful for the review.

It might be unrelated to your change here, but the input switch thing didn't seem to do anything for me. If I record two files, open the first one, press S and select the second file nothing seems to change. I assumed it would show the other file but nothing changes?

Quoted 5 lines
    $ perf record -- true
    $ perf record -o 2.data -- ls
    $ perf report
    S key
    load 2.data

Yes, sure. This needs "--sort symbol":

perf report --sort symbol

then press 's', select file, and it terminates.

Affects fewer cases then I initially assumed, since I happened to run with "--sort symbol" when I discovered it.

Quoted 7 lines
Quoted 4 lines

Ah yeah I can reproduce the bug with --sort, which is fixed by the patch. But 's' doesn't actually reload a new histogram for me, I just get the original file again. Maybe I'm misunderstanding what 's' is supposed to do?

As far as I understand, 's' allows you to select and load a new profile w/o existing (fwiw, if you select a different file). If the

By 'without existing' do you mean running perf report with no perf.data file? It won't run like that it just says "failed to open perf.data"

Quoted 2 lines

file has changed, I guess you can also reload it and see the changes.

Quoted 8 lines

I wasn't able to make that work. How do you reload? If I change screen between different events I still get the old file and I didn't see 'reload' mentioned in the keybinding popup.

I suppose my point is maybe it's not worth fixing the sort order bug if we can just remove input file switching. The behavior doesn't seem any different to v5.8 in case its a regression. Maybe I'm just doing something wrong though.

Humm... indeed, it does not seem to actually reload anything (even though the "Processing events..." progress bar progresses again).

I tried to use the reloading feature while implementing:

perf report: Add wall-clock and parallelism profiling
https://lore.kernel.org/linux-perf-users/[email protected]/

to change some of the flags that can't be changed otherwise, but then dropped this idea since it was too messy, but decided to fix the failure I discovered.

So, yes, I guess we can drop this patch (I don't need it anymore).

Quoted 58 lines
Quoted 57 lines
Quoted 57 lines
Quoted 56 lines
Quoted 56 lines
Quoted 3 lines
Fixes ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol")
Cc Namhyung Kim <[email protected]>> Cc: Ian Rogers

<[email protected]>

Quoted 51 lines
---
    tools/perf/builtin-report.c | 30 ++++++++++++++++--------------
    1 file changed, 16 insertions(+), 14 deletions(-)
tools/perf/builtin-report.c +16 -14
index 048c91960ba91..42d7dfdf07d9b 100644
@@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv)
                symbol_conf.annotate_data_sample = true;
        }
 
-     if (sort_order && strstr(sort_order, "ipc")) {
-             parse_options_usage(report_usage, options, "s", 1);
-             goto error;
-     }
-
-     if (sort_order && strstr(sort_order, "symbol")) {
-             if (sort__mode == SORT_MODE__BRANCH) {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_lbr");
-                     report.symbol_ipc = true;
-             } else {
-                     snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
-                              sort_order, "ipc_null");
+     if (last_key != K_SWITCH_INPUT_DATA) {
+             if (sort_order && strstr(sort_order, "ipc")) {
+                     parse_options_usage(report_usage, options, "s", 1);
+                     goto error;
                }
 
-             sort_order = sort_tmp;
+             if (sort_order && strstr(sort_order, "symbol")) {
+                     if (sort__mode == SORT_MODE__BRANCH) {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_lbr");
+                             report.symbol_ipc = true;
+                     } else {
+                             snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
+                                      sort_order, "ipc_null");
+                     }
+
+                     sort_order = sort_tmp;
+             }
        }
 
        if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&

base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780

maintainer
#7 lore raw

Hello,

Quoted 69 lines · Dmitry Vyukov
Quoted 53 lines · James Clark
Quoted 37 lines · Dmitry Vyukov
Quoted 36 lines · James Clark
Quoted 34 lines · Dmitry Vyukov
Quoted 17 lines · James Clark
Quoted 5 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Hi Dmitry,

A reproducer with before and after behavior might be helpful for the review.

It might be unrelated to your change here, but the input switch thing didn't seem to do anything for me. If I record two files, open the first one, press S and select the second file nothing seems to change. I assumed it would show the other file but nothing changes?

Quoted 5 lines
    $ perf record -- true
    $ perf record -o 2.data -- ls
    $ perf report
    S key
    load 2.data

Yes, sure. This needs "--sort symbol":

perf report --sort symbol

then press 's', select file, and it terminates.

Affects fewer cases then I initially assumed, since I happened to run with "--sort symbol" when I discovered it.

Quoted 7 lines
Quoted 4 lines

Ah yeah I can reproduce the bug with --sort, which is fixed by the patch. But 's' doesn't actually reload a new histogram for me, I just get the original file again. Maybe I'm misunderstanding what 's' is supposed to do?

As far as I understand, 's' allows you to select and load a new profile w/o existing (fwiw, if you select a different file). If the

By 'without existing' do you mean running perf report with no perf.data file? It won't run like that it just says "failed to open perf.data"

Quoted 2 lines

file has changed, I guess you can also reload it and see the changes.

Quoted 8 lines

I wasn't able to make that work. How do you reload? If I change screen between different events I still get the old file and I didn't see 'reload' mentioned in the keybinding popup.

I suppose my point is maybe it's not worth fixing the sort order bug if we can just remove input file switching. The behavior doesn't seem any different to v5.8 in case its a regression. Maybe I'm just doing something wrong though.

Humm... indeed, it does not seem to actually reload anything (even though the "Processing events..." progress bar progresses again).

I tried to use the reloading feature while implementing:

Quoted 8 lines

perf report: Add wall-clock and parallelism profiling
https://lore.kernel.org/linux-perf-users/[email protected]/

to change some of the flags that can't be changed otherwise, but then dropped this idea since it was too messy, but decided to fix the failure I discovered.

So, yes, I guess we can drop this patch (I don't need it anymore).

Sorry for the long delay but I think we need this fix anyway. I'll take a look at the reload issue later.

Thanks,
Namhyung

maintainer Applied
#8 lore raw
In reply to Dmitry Vyukov
Quoted 6 lines · Dmitry Vyukov

Currently the code checks that there is no "ipc" in the sort order and add an ipc string. This will always error out on the second pass after input reload/switch, since the sort order already contains "ipc". Do the ipc check/fixup only on the first pass.

Applied to perf-tools-next, thanks!

Best regards,
Namhyung