From: Robert Richter <robert.richter@amd.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
oprofile-list <oprofile-list@lists.sourceforge.net>,
Robert Richter <robert.richter@amd.com>
Subject: [PATCH 4/9] oprofile: add op_cpu_buffer_add_data()
Date: Wed, 7 Jan 2009 23:45:20 +0100 [thread overview]
Message-ID: <1231368325-19246-5-git-send-email-robert.richter@amd.com> (raw)
In-Reply-To: <1231368325-19246-1-git-send-email-robert.richter@amd.com>
This function can be used to attach data to a sample. It returns the
remaining free buffer size that has been reserved with
op_cpu_buffer_write_reserve().
Signed-off-by: Robert Richter <robert.richter@amd.com>
---
drivers/oprofile/cpu_buffer.c | 2 +-
drivers/oprofile/cpu_buffer.h | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index e859d23..1b65907 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -258,7 +258,7 @@ op_add_code(struct oprofile_cpu_buffer *cpu_buf, unsigned long backtrace,
sample->event = flags;
if (size)
- sample->data[0] = (unsigned long)task;
+ op_cpu_buffer_add_data(&entry, (unsigned long)task);
op_cpu_buffer_write_commit(&entry);
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index e634dcf..e178dd2 100644
--- a/drivers/oprofile/cpu_buffer.h
+++ b/drivers/oprofile/cpu_buffer.h
@@ -78,6 +78,18 @@ int op_cpu_buffer_write_commit(struct op_entry *entry);
struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu);
unsigned long op_cpu_buffer_entries(int cpu);
+/* returns the remaining free size of data in the entry */
+static inline
+int op_cpu_buffer_add_data(struct op_entry *entry, unsigned long val)
+{
+ if (!entry->size)
+ return 0;
+ *entry->data = val;
+ entry->size--;
+ entry->data++;
+ return entry->size;
+}
+
/* extra data flags */
#define KERNEL_CTX_SWITCH (1UL << 0)
#define IS_KERNEL (1UL << 1)
--
1.6.0.1
next prev parent reply other threads:[~2009-01-07 22:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 22:45 [PATCH 0/9] oprofile: implement support of samples with variable data size Robert Richter
2009-01-07 22:45 ` [PATCH 1/9] oprofile: add op_cpu_buffer_write_reserve() Robert Richter
2009-01-07 22:45 ` [PATCH 2/9] oprofile: modify op_cpu_buffer_read_entry() Robert Richter
2009-01-07 22:45 ` [PATCH 3/9] oprofile: rework implementation of cpu buffer events Robert Richter
2009-01-07 22:45 ` Robert Richter [this message]
2009-01-07 22:45 ` [PATCH 5/9] oprofile: add op_cpu_buffer_get_data() Robert Richter
2009-01-07 22:45 ` [PATCH 6/9] oprofile: use new data sample format for ibs Robert Richter
2009-01-07 22:45 ` [PATCH 7/9] ring_buffer: fix ring_buffer_event_length() Robert Richter
2009-01-07 22:45 ` [PATCH 8/9] oprofile: remove #ifdef CONFIG_OPROFILE_IBS in non-ibs code Robert Richter
2009-01-07 22:45 ` [PATCH 9/9] oprofile: make new cpu buffer functions part of the api Robert Richter
2009-01-14 21:53 ` [PATCH 0/9] oprofile: implement support of samples with variable data size Maynard Johnson
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=1231368325-19246-5-git-send-email-robert.richter@amd.com \
--to=robert.richter@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oprofile-list@lists.sourceforge.net \
/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
Powered by JetHome