Skip to contentSkip to conversation

perf timechart record: fix off-by-one error in argv

PATCH In review Ramkumar Ramachandra 3 participants 3 messages Mar 16, 2014 – Mar 19, 2014 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf timechart record: fix off-by-one error in argv

Since 367b315 (perf timechart: Add support for -P and -T in timechart recording, 2013-11-01), the 'perf timechart record' command stopped working:

  $ perf timechart record -- git status
  Workload failed: No such file or directory

This happens because of an off-by-one error while preparing the argv for cmd_record(): it attempts to execute the command 'status' and complains that it doesn't exist. Fix this error.

Cc Stanislav Fomichev <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/builtin-timechart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-timechart.c +1 -1
index 25526d6..d4991a2 100644
@@ -1238,7 +1238,7 @@ static int timechart__record(struct timechart *tchart, int argc, const char **ar
 	for (i = 0; i < old_power_args_nr; i++)
 		*p++ = strdup(old_power_args[i]);
 
-	for (j = 1; j < (unsigned int)argc; j++)
+	for (j = 0; j < (unsigned int)argc; j++)
 		*p++ = argv[j];
 
 	return cmd_record(rec_argc, rec_argv, NULL);
Signature · 1 line
1.9.rc0.1.g9d22d25
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Ramkumar Ramachandra

Since 367b315 (perf timechart: Add support for -P and -T in timechart recording, 2013-11-01), the 'perf timechart record' command stopped working:

Quoted 8 lines
  $ perf timechart record -- git status
  Workload failed: No such file or directory

This happens because of an off-by-one error while preparing the argv for cmd_record(): it attempts to execute the command 'status' and complains that it doesn't exist. Fix this error.

Cc Stanislav Fomichev <[email protected]>

Thanks. I probably never actually tested it with the command :-\

#2 lore raw

[tip:perf/core] perf timechart: Fix off-by-one error in 'record' argv handling

In reply to Ramkumar Ramachandra
perf timechart: Fix off-by-one error in 'record' argv handling
Commit-ID:  263f89bf7d0f5ba98077dda8df1ff814862ad5ba
Gitweb:     http://git.kernel.org/tip/263f89bf7d0f5ba98077dda8df1ff814862ad5ba
Author:     Ramkumar Ramachandra <[email protected]>
AuthorDate: Sun, 16 Mar 2014 12:06:05 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 18 Mar 2014 18:16:47 -0300

perf timechart: Fix off-by-one error in 'record' argv handling

Since 367b315 (perf timechart: Add support for -P and -T in timechart recording, 2013-11-01), the 'perf timechart record' command stopped working:

  $ perf timechart record -- git status
  Workload failed: No such file or directory

This happens because of an off-by-one error while preparing the argv for cmd_record(): it attempts to execute the command 'status' and complains that it doesn't exist. Fix this error.

---
 tools/perf/builtin-timechart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-timechart.c +1 -1
index 25526d6..d4991a2 100644
@@ -1238,7 +1238,7 @@ static int timechart__record(struct timechart *tchart, int argc, const char **ar
 	for (i = 0; i < old_power_args_nr; i++)
 		*p++ = strdup(old_power_args[i]);
 
-	for (j = 1; j < (unsigned int)argc; j++)
+	for (j = 0; j < (unsigned int)argc; j++)
 		*p++ = argv[j];
 
 	return cmd_record(rec_argc, rec_argv, NULL);