From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Arjan van de Ven <arjan@linux.intel.com>,
David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Stanislav Fomichev <stfomichev@yandex-team.ru>,
Steven Rostedt <rostedt@goodmis.org>,
Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 04/35] perf timechart: Use NSEC_PER_U?SEC
Date: Tue, 23 Aug 2016 18:03:05 -0300 [thread overview]
Message-ID: <1471986216-18390-5-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1471986216-18390-1-git-send-email-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Following kernel practices, using linux/time64.h
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5l1md8lsdhfnrlsqyejzo9w2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-timechart.c | 13 +++++++------
tools/perf/util/svghelper.c | 11 ++++++-----
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 733a55422d03..e7eaa298d34a 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -24,6 +24,7 @@
#include "util/evlist.h"
#include "util/evsel.h"
#include <linux/rbtree.h>
+#include <linux/time64.h>
#include "util/symbol.h"
#include "util/callchain.h"
#include "util/strlist.h"
@@ -1288,9 +1289,9 @@ static void draw_process_bars(struct timechart *tchart)
if (c->comm) {
char comm[256];
if (c->total_time > 5000000000) /* 5 seconds */
- sprintf(comm, "%s:%i (%2.2fs)", c->comm, p->pid, c->total_time / 1000000000.0);
+ sprintf(comm, "%s:%i (%2.2fs)", c->comm, p->pid, c->total_time / (double)NSEC_PER_SEC);
else
- sprintf(comm, "%s:%i (%3.1fms)", c->comm, p->pid, c->total_time / 1000000.0);
+ sprintf(comm, "%s:%i (%3.1fms)", c->comm, p->pid, c->total_time / (double)NSEC_PER_MSEC);
svg_text(Y, c->start_time, comm);
}
@@ -1637,7 +1638,7 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name)
write_svg_file(tchart, output_name);
pr_info("Written %2.1f seconds of trace to %s.\n",
- (tchart->last_time - tchart->first_time) / 1000000000.0, output_name);
+ (tchart->last_time - tchart->first_time) / (double)NSEC_PER_SEC, output_name);
out_delete:
perf_session__delete(session);
return ret;
@@ -1901,10 +1902,10 @@ parse_time(const struct option *opt, const char *arg, int __maybe_unused unset)
if (sscanf(arg, "%" PRIu64 "%cs", value, &unit) > 0) {
switch (unit) {
case 'm':
- *value *= 1000000;
+ *value *= NSEC_PER_MSEC;
break;
case 'u':
- *value *= 1000;
+ *value *= NSEC_PER_USEC;
break;
case 'n':
break;
@@ -1928,7 +1929,7 @@ int cmd_timechart(int argc, const char **argv,
.ordered_events = true,
},
.proc_num = 15,
- .min_time = 1000000,
+ .min_time = NSEC_PER_MSEC,
.merge_dist = 1000,
};
const char *output_name = "output.svg";
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index eec6c1149f44..1cbada2dc6be 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -18,6 +18,7 @@
#include <unistd.h>
#include <string.h>
#include <linux/bitmap.h>
+#include <linux/time64.h>
#include "perf.h"
#include "svghelper.h"
@@ -274,14 +275,14 @@ static char *time_to_string(u64 duration)
text[0] = 0;
- if (duration < 1000) /* less than 1 usec */
+ if (duration < NSEC_PER_USEC) /* less than 1 usec */
return text;
- if (duration < 1000 * 1000) { /* less than 1 msec */
- sprintf(text, "%.1f us", duration / 1000.0);
+ if (duration < NSEC_PER_MSEC) { /* less than 1 msec */
+ sprintf(text, "%.1f us", duration / (double)NSEC_PER_USEC);
return text;
}
- sprintf(text, "%.1f ms", duration / 1000.0 / 1000);
+ sprintf(text, "%.1f ms", duration / (double)NSEC_PER_MSEC);
return text;
}
@@ -297,7 +298,7 @@ void svg_waiting(int Yslot, int cpu, u64 start, u64 end, const char *backtrace)
style = "waiting";
- if (end-start > 10 * 1000000) /* 10 msec */
+ if (end-start > 10 * NSEC_PER_MSEC) /* 10 msec */
style = "WAITING";
text = time_to_string(end-start);
--
2.7.4
next prev parent reply other threads:[~2016-08-23 21:54 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 01/35] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 02/35] perf bench numa: Use NSEC_PER_U?SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 03/35] perf sched: Use linux/time64.h Arnaldo Carvalho de Melo
2016-08-23 21:03 ` Arnaldo Carvalho de Melo [this message]
2016-08-23 21:03 ` [PATCH 05/35] perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 06/35] perf stat: Use *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 07/35] perf bench mem: Use USEC_PER_SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 08/35] perf bench sched-messaging: Use USEC_PER_MSEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 09/35] perf record: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 10/35] perf kvm: Use NSEC_PER_USEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 11/35] perf bench futex: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 12/35] perf top: Use MSEC_PER_SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 13/35] perf hists: Introduce nr_header_lines into struct perf_hpp_list Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 14/35] perf hists: Add line argument into perf_hpp_fmt's header callback Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 15/35] perf tools tui: Display multiple header lines Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 16/35] perf tools stdio: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 17/35] perf hists: Add support for header span Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 18/35] perf disassemble: Move check for kallsyms + !kcore Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 19/35] perf disassemble: Simplify logic for picking the filename to disassemble Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 20/35] perf disassemble: Extract logic to find file to pass to objdump to a separate function Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 21/35] tools: Copy coresight-pmu.h header file needed by perf tools Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 22/35] perf report: Allow configuring the default sort order in ~/.perfconfig Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 23/35] perf tools: Use __weak definition from linux/compiler.h Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 24/35] perf tools: Skip running the feature tests for 'make install-doc' Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 25/35] perf hists browser: Remove superfluous null check on map Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 26/35] ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 27/35] ftrace: probe: Add README entries for k/uprobe-events Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 28/35] perf probe: Add supported for type casting by the running kernel Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 29/35] perf probe: Support hexadecimal casting Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 30/35] perf probe: Use hexadecimal type by default if possible Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 31/35] ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 32/35] perf tools: Fix typo: "ehough" -> "enough" Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 33/35] perf test bpf: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 34/35] perf " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 35/35] perf record: Fix spelling mistake "Finshed" -> "Finished" Arnaldo Carvalho de Melo
2016-08-24 9:09 ` [GIT PULL 00/35] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471986216-18390-5-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=arjan@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.org \
--cc=stfomichev@yandex-team.ru \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).