lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-44f7e432e3dc8a13f5661e8b722f53645df083d1@git.kernel.org>
Date:	Thu, 2 Apr 2015 22:10:07 -0700
From:	tip-bot for Yunlong Song <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	paulus@...ba.org, tglx@...utronix.de, wangnan0@...wei.com,
	linux-kernel@...r.kernel.org, a.p.zijlstra@...llo.nl,
	mingo@...nel.org, yunlong.song@...wei.com, hpa@...or.com,
	acme@...hat.com
Subject: [tip:perf/core] perf timechart:
  Support using -f to override perf.data file ownership

Commit-ID:  44f7e432e3dc8a13f5661e8b722f53645df083d1
Gitweb:     http://git.kernel.org/tip/44f7e432e3dc8a13f5661e8b722f53645df083d1
Author:     Yunlong Song <yunlong.song@...wei.com>
AuthorDate: Thu, 2 Apr 2015 21:47:17 +0800
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 2 Apr 2015 13:18:50 -0300

perf timechart: Support using -f to override perf.data file ownership

Enable perf timechart to use perf.data when it is not owned by current
user or root.

Example:

 # perf timechart record ls
 # chown Yunlong.Song:Yunlong.Song perf.data
 # ls -al perf.data
 -rw------- 1 Yunlong.Song Yunlong.Song 5471744 Apr  2 15:15 perf.data
 # id
 uid=0(root) gid=0(root) groups=0(root),64(pkcs11)

Before this patch:

 # perf timechart
 File perf.data not owned by current user or root (use -f to override)
 # perf timechart -f
   Error: unknown switch `f'

  usage: perf timechart [<options>] {record}

     -i, --input <file>    input file name
     -o, --output <file>   output file name
     -w, --width <n>       page width
         --highlight <duration or task name>
                           highlight tasks. Pass duration in ns or process name.
     -P, --power-only      output power data only
     -T, --tasks-only      output processes data only
     -p, --process <process>
                           process selector. Pass a pid or process name.
         --symfs <directory>
                           Look for files with symbols relative to this directory
     -n, --proc-num <n>    min. number of tasks to print
     -t, --topology        sort CPUs according to topology
         --io-skip-eagain  skip EAGAIN errors
         --io-min-time <time>
                           all IO faster than min-time will visually appear longer
         --io-merge-dist <time>
                           merge events that are merge-dist us apart

As shown above, the -f option does not work at all.

After this patch:

 # perf timechart
 File perf.data not owned by current user or root (use -f to override)
 # perf timechart -f
 Written 0.0 seconds of trace to output.svg.
 # cat output.svg
 <?xml version="1.0" standalone="no"?>
 <!DOCTYPE svg SYSTEM "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 <svg width="1000" height="10110" version="1.1" xmlns="http://www.w3.org/2000/svg">
 <defs>
   <style type="text/css">
     <![CDATA[
       rect          { stroke-width: 1; }
 ...
 ...

As shown above, the -f option really works now.

Signed-off-by: Yunlong Song <yunlong.song@...wei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/1427982439-27388-9-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-timechart.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 494b3bb..e50fe11 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -67,6 +67,7 @@ struct timechart {
 				skip_eagain;
 	u64			min_time,
 				merge_dist;
+	bool			force;
 };
 
 struct per_pidcomm;
@@ -1598,6 +1599,7 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name)
 	struct perf_data_file file = {
 		.path = input_name,
 		.mode = PERF_DATA_MODE_READ,
+		.force = tchart->force,
 	};
 
 	struct perf_session *session = perf_session__new(&file, false,
@@ -1956,6 +1958,7 @@ int cmd_timechart(int argc, const char **argv,
 	OPT_CALLBACK(0, "io-merge-dist", &tchart.merge_dist, "time",
 		     "merge events that are merge-dist us apart",
 		     parse_time),
+	OPT_BOOLEAN('f', "force", &tchart.force, "don't complain, do it"),
 	OPT_END()
 	};
 	const char * const timechart_subcommands[] = { "record", NULL };
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ