[gnome-builder] egg: make rdtscp call handle masking core bits
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] egg: make rdtscp call handle masking core bits
- Date: Thu, 17 Sep 2015 09:51:28 +0000 (UTC)
commit 68a6694db947482494159afd53edec560f151823
Author: Christian Hergert <christian hergert me>
Date: Thu Sep 17 02:49:37 2015 -0700
egg: make rdtscp call handle masking core bits
Only the bottom 12 bits contain the cpu identifier. The following bits are
the numa node.
contrib/egg/egg-counter.h | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/contrib/egg/egg-counter.h b/contrib/egg/egg-counter.h
index 42e62ba..ca27fe8 100644
--- a/contrib/egg/egg-counter.h
+++ b/contrib/egg/egg-counter.h
@@ -146,9 +146,14 @@ G_BEGIN_DECLS
static inline guint
egg_get_current_cpu (void)
{
- guint cpu;
- __builtin_ia32_rdtscp (&cpu);
- return cpu;
+ /*
+ * This extracts the IA32_TSC_AUX into the ecx register. On Linux,
+ * that value contains a value with the bottom 12 bits being the
+ * cpu identifier, and the next 10 bits being the node group.
+ */
+ guint aux;
+ __builtin_ia32_rdtscp (&aux);
+ return aux & 0xFFF;
}
#elif defined(__linux__)
# ifndef _GNU_SOURCE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]