[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1369527896-3650-15-git-send-email-dsahern@gmail.com>
Date: Sat, 25 May 2013 18:24:54 -0600
From: David Ahern <dsahern@...il.com>
To: linux-kernel@...r.kernel.org
Cc: acme@...stprotocols.net, mingo@...nel.org, fweisbec@...il.com,
peterz@...radead.org, jolsa@...hat.com, namhyung@...nel.org,
xiaoguangrong@...ux.vnet.ibm.com, runzhen@...ux.vnet.ibm.com,
Runzhen Wang <icycoder@...il.com>,
David Ahern <dsahern@...il.com>
Subject: [PATCH 14/16] perf kvm: reuse some code of perf_kvm__timerfd_create()
From: Runzhen Wang <icycoder@...il.com>
Create a new function perf_kvm__timerfd_set() to reuse some code
in perf_kvm__timerfd_create()
Signed-off-by: Runzhen Wang <runzhen@...ux.vnet.ibm.com>
Signed-off-by: David Ahern <dsahern@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
---
tools/perf/builtin-kvm.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 76cfe59..7392538 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -940,16 +940,9 @@ static void sig_handler(int sig __maybe_unused)
done = 1;
}
-static int perf_kvm__timerfd_create(struct perf_kvm_stat *kvm)
+static int perf_kvm__timerfd_set(struct perf_kvm_stat *kvm)
{
struct itimerspec new_value;
- int rc = -1;
-
- kvm->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
- if (kvm->timerfd < 0) {
- pr_err("timerfd_create failed\n");
- goto out;
- }
new_value.it_value.tv_sec = kvm->display_time;
new_value.it_value.tv_nsec = 0;
@@ -959,12 +952,20 @@ static int perf_kvm__timerfd_create(struct perf_kvm_stat *kvm)
if (timerfd_settime(kvm->timerfd, 0, &new_value, NULL) != 0) {
pr_err("timerfd_settime failed: %d\n", errno);
close(kvm->timerfd);
- goto out;
+ return -1;
}
- rc = 0;
-out:
- return rc;
+ return 0;
+}
+
+static int perf_kvm__timerfd_create(struct perf_kvm_stat *kvm)
+{
+ kvm->timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
+ if (kvm->timerfd < 0) {
+ pr_err("timerfd_create failed\n");
+ return -1;
+ }
+ return perf_kvm__timerfd_set(kvm);
}
static int perf_kvm__handle_timerfd(struct perf_kvm_stat *kvm)
--
1.7.10.1
--
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