From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dsahern@gmail.com, hpa@zytor.com, jolsa@kernel.org,
mingo@kernel.org, namhyung@kernel.org,
linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
eranian@google.com, acme@redhat.com, tglx@linutronix.de,
ak@linux.intel.com
Subject: [tip:perf/core] perf tools: Change perf_mem__lck_scnprintf to return nb of displayed bytes
Date: Wed, 24 Feb 2016 23:39:28 -0800 [thread overview]
Message-ID: <tip-8b0819c8a3c97279b815581b606407c0387cc26f@git.kernel.org> (raw)
In-Reply-To: <1456303616-26926-13-git-send-email-jolsa@kernel.org>
Commit-ID: 8b0819c8a3c97279b815581b606407c0387cc26f
Gitweb: http://git.kernel.org/tip/8b0819c8a3c97279b815581b606407c0387cc26f
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 24 Feb 2016 09:46:53 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 24 Feb 2016 10:31:03 -0300
perf tools: Change perf_mem__lck_scnprintf to return nb of displayed bytes
Moving strncat call into scnprintf to easily track number of displayed
bytes. It will be used in following patch.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1456303616-26926-13-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/mem-events.c | 12 +++++++-----
tools/perf/util/mem-events.h | 2 +-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index de981dd..eadb83d 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -221,18 +221,20 @@ int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info)
return l;
}
-void perf_mem__lck_scnprintf(char *out, size_t sz __maybe_unused,
- struct mem_info *mem_info)
+int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info)
{
u64 mask = PERF_MEM_LOCK_NA;
+ int l;
if (mem_info)
mask = mem_info->data_src.mem_lock;
if (mask & PERF_MEM_LOCK_NA)
- strncat(out, "N/A", 3);
+ l = scnprintf(out, sz, "N/A");
else if (mask & PERF_MEM_LOCK_LOCKED)
- strncat(out, "Yes", 3);
+ l = scnprintf(out, sz, "Yes");
else
- strncat(out, "No", 2);
+ l = scnprintf(out, sz, "No");
+
+ return l;
}
diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
index 84c79a4..87c44ff 100644
--- a/tools/perf/util/mem-events.h
+++ b/tools/perf/util/mem-events.h
@@ -28,6 +28,6 @@ struct mem_info;
int perf_mem__tlb_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
-void perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
+int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
#endif /* __PERF_MEM_EVENTS_H */
next prev parent reply other threads:[~2016-02-25 7:39 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 8:46 [PATCHv2 00/15] perf tools: Several memory events updates Jiri Olsa
2016-02-24 8:46 ` [PATCH 01/15] perf mem: Check for memory events support Jiri Olsa
2016-02-25 7:36 ` [tip:perf/core] perf mem record: " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 02/15] perf mem: Introduce perf_mem_events__name function Jiri Olsa
2016-02-25 7:36 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 03/15] perf mem: Add -l/--ldlat option Jiri Olsa
2016-02-24 13:14 ` Arnaldo Carvalho de Melo
2016-02-24 19:16 ` Jiri Olsa
2016-02-24 8:46 ` [PATCH 04/15] perf mem: Add -u/-k options Jiri Olsa
2016-02-24 13:17 ` Arnaldo Carvalho de Melo
2016-02-24 19:17 ` Jiri Olsa
2016-02-24 8:46 ` [PATCH 05/15] perf tools: Introduce perf_mem__tlb_scnprintf function Jiri Olsa
2016-02-24 13:18 ` Arnaldo Carvalho de Melo
2016-02-25 7:37 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 06/15] perf tools: Introduce perf_mem__lvl_scnprintf function Jiri Olsa
2016-02-25 7:37 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 07/15] perf tools: Introduce perf_mem__snp_scnprintf function Jiri Olsa
2016-02-25 7:37 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 08/15] perf tools: Introduce perf_mem__lck_scnprintf function Jiri Olsa
2016-02-25 7:38 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 09/15] perf tools: Change perf_mem__tlb_scnprintf to return nb of displayed bytes Jiri Olsa
2016-02-25 7:38 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 10/15] perf tools: Change perf_mem__lvl_scnprintf " Jiri Olsa
2016-02-25 7:38 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 11/15] perf tools: Change perf_mem__snp_scnprintf " Jiri Olsa
2016-02-25 7:39 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 12/15] perf tools: Change perf_mem__lck_scnprintf " Jiri Olsa
2016-02-25 7:39 ` tip-bot for Jiri Olsa [this message]
2016-02-24 8:46 ` [PATCH 13/15] perf script: Display data_src values Jiri Olsa
2016-02-24 13:34 ` Arnaldo Carvalho de Melo
2016-02-24 19:18 ` Jiri Olsa
2016-02-25 7:39 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-24 8:46 ` [PATCH 14/15] perf x86 intel: Add DATALA events into sysfs Jiri Olsa
2016-02-24 15:59 ` Andi Kleen
2016-02-24 18:54 ` Jiri Olsa
2016-02-24 8:46 ` [PATCH 15/15] perf mem: Add Intel DATALA memory events Jiri Olsa
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=tip-8b0819c8a3c97279b815581b606407c0387cc26f@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
/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