From: Shang XiaoJing <shangxiaojing@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
<jolsa@kernel.org>, <namhyung@kernel.org>,
<linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <shangxiaojing@huawei.com>
Subject: [PATCH 1/4] perf trace: Use zalloc to save initialization of syscall_stats
Date: Thu, 8 Sep 2022 10:11:38 +0800 [thread overview]
Message-ID: <20220908021141.27134-2-shangxiaojing@huawei.com> (raw)
In-Reply-To: <20220908021141.27134-1-shangxiaojing@huawei.com>
As most members of syscall_stats is set to 0 in thread__update_stats,
using zalloc directly.
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
tools/perf/builtin-trace.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 0bd9d01c0df9..3ecc31375f90 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2173,13 +2173,10 @@ static void thread__update_stats(struct thread *thread, struct thread_trace *ttr
stats = inode->priv;
if (stats == NULL) {
- stats = malloc(sizeof(*stats));
+ stats = zalloc(sizeof(*stats));
if (stats == NULL)
return;
- stats->nr_failures = 0;
- stats->max_errno = 0;
- stats->errnos = NULL;
init_stats(&stats->stats);
inode->priv = stats;
}
--
2.17.1
next prev parent reply other threads:[~2022-09-08 1:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 2:11 [PATCH 0/4] perf: Clean up by adding helpers Shang XiaoJing
2022-09-08 2:11 ` Shang XiaoJing [this message]
2022-09-08 2:11 ` [PATCH 2/4] perf lock: Add get_key_by_aggr_mode helper Shang XiaoJing
2022-09-08 2:11 ` [PATCH 3/4] perf timechart: Add create_pidcomm helper Shang XiaoJing
2022-09-08 2:11 ` [PATCH 4/4] perf timechart: Add p_state_end helper Shang XiaoJing
2022-09-08 7:08 ` [PATCH 0/4] perf: Clean up by adding helpers Namhyung Kim
2022-09-08 18:23 ` Arnaldo Carvalho de Melo
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=20220908021141.27134-2-shangxiaojing@huawei.com \
--to=shangxiaojing@huawei.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®