linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: LKML <linux-kernel@vger.kernel.org>,
	linux-pm <linux-pm@lists.linux-foundation.org>
Cc: a.p.zijlstra@chello.nl, mingo@elte.hu, ming.m.lin@intel.com,
	acme@redhat.com, "Brown, Len" <lenb@kernel.org>
Subject: [PATCH 3/3] show energy consumption info in perf tool
Date: Thu, 26 May 2011 16:34:15 +0800	[thread overview]
Message-ID: <1306398855.2207.156.camel@rui> (raw)


Introduce four new perf software events
PERF_COUNT_SW_PKG_ENERGY
PERF_COUNT_SW_CORE_ENERGY
PERF_COUNT_SW_UNCORE_ENERGY
and
PERF_COUNT_SW_DRAM_ENERGY

To use it, users can run
perf stat -e pkg-energy foo
to get the package energy consumption when running foo.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 tools/perf/design.txt          |    4 ++++
 tools/perf/util/parse-events.c |    8 ++++++++
 2 files changed, 12 insertions(+)

Index: linux-2.6/tools/perf/design.txt
===================================================================
--- linux-2.6.orig/tools/perf/design.txt
+++ linux-2.6/tools/perf/design.txt
@@ -139,6 +139,10 @@ enum sw_event_ids {
 	PERF_COUNT_SW_PAGE_FAULTS_MAJ	= 6,
 	PERF_COUNT_SW_ALIGNMENT_FAULTS	= 7,
 	PERF_COUNT_SW_EMULATION_FAULTS	= 8,
+	PERF_COUNT_SW_PKG_ENERGY	= 9,
+	PERF_COUNT_SW_CORE_ENERGY	= 10,
+	PERF_COUNT_SW_UNCORE_ENERGY	= 11,
+	PERF_COUNT_SW_DRAM_ENERGY	= 12,
 };
 
 Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event
Index: linux-2.6/tools/perf/util/parse-events.c
===================================================================
--- linux-2.6.orig/tools/perf/util/parse-events.c
+++ linux-2.6/tools/perf/util/parse-events.c
@@ -50,6 +50,10 @@ static struct event_symbol event_symbols
   { CSW(CPU_MIGRATIONS),		"cpu-migrations",		"migrations"		},
   { CSW(ALIGNMENT_FAULTS),		"alignment-faults",		""			},
   { CSW(EMULATION_FAULTS),		"emulation-faults",		""			},
+  { CSW(PKG_ENERGY),			"pkg-energy",			""			},
+  { CSW(CORE_ENERGY),			"core-energy",			""			},
+  { CSW(UNCORE_ENERGY),			"uncore-energy",		""			},
+  { CSW(DRAM_ENERGY),			"dram-energy",			""			},
 };
 
 #define __PERF_EVENT_FIELD(config, name) \
@@ -82,6 +86,10 @@ static const char *sw_event_names[PERF_C
 	"major-faults",
 	"alignment-faults",
 	"emulation-faults",
+	"package-energy-consumption",
+	"core-energy-consumption",
+	"uncore-energy-consumption",
+	"dram-energy-consumption",
 };
 
 #define MAX_ALIASES 8



             reply	other threads:[~2011-05-26  8:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26  8:34 Zhang Rui [this message]
2011-05-26 10:49 ` [PATCH 3/3] show energy consumption info in perf tool 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=1306398855.2207.156.camel@rui \
    --to=rui.zhang@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    /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).