[gjs: 4/7] mem: Add index to counter macros
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 4/7] mem: Add index to counter macros
- Date: Sun, 4 Jul 2021 19:09:38 +0000 (UTC)
commit 9f40392e870237243d10cfad5bb4d1b1c271b1b3
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Mar 14 13:28:58 2021 -0700
mem: Add index to counter macros
This is needed for creating an array of counter values to pass to sysprof.
See: #292
gjs/mem-private.h | 36 ++++++++++++++++++------------------
gjs/mem.cpp | 6 +++---
2 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/gjs/mem-private.h b/gjs/mem-private.h
index e4bdc750..8c6caca5 100644
--- a/gjs/mem-private.h
+++ b/gjs/mem-private.h
@@ -10,22 +10,22 @@
// clang-format off
#define GJS_FOR_EACH_COUNTER(macro) \
- macro(boxed_instance) \
- macro(boxed_prototype) \
- macro(closure) \
- macro(function) \
- macro(fundamental_instance) \
- macro(fundamental_prototype) \
- macro(gerror_instance) \
- macro(gerror_prototype) \
- macro(interface) \
- macro(module) \
- macro(ns) \
- macro(object_instance) \
- macro(object_prototype) \
- macro(param) \
- macro(union_instance) \
- macro(union_prototype)
+ macro(boxed_instance, 0) \
+ macro(boxed_prototype, 1) \
+ macro(closure, 2) \
+ macro(function, 3) \
+ macro(fundamental_instance, 4) \
+ macro(fundamental_prototype, 5) \
+ macro(gerror_instance, 6) \
+ macro(gerror_prototype, 7) \
+ macro(interface, 8) \
+ macro(module, 9) \
+ macro(ns, 10) \
+ macro(object_instance, 11) \
+ macro(object_prototype, 12) \
+ macro(param, 13) \
+ macro(union_instance, 14) \
+ macro(union_prototype, 15)
// clang-format on
namespace Gjs {
@@ -38,8 +38,8 @@ struct Counter {
};
namespace Counters {
-#define GJS_DECLARE_COUNTER(name) extern Counter name;
-GJS_DECLARE_COUNTER(everything)
+#define GJS_DECLARE_COUNTER(name, ix) extern Counter name;
+GJS_DECLARE_COUNTER(everything, -1)
GJS_FOR_EACH_COUNTER(GJS_DECLARE_COUNTER)
#undef GJS_DECLARE_COUNTER
diff --git a/gjs/mem.cpp b/gjs/mem.cpp
index 74794430..56814c6d 100644
--- a/gjs/mem.cpp
+++ b/gjs/mem.cpp
@@ -15,15 +15,15 @@
namespace Gjs {
namespace Memory {
namespace Counters {
-#define GJS_DEFINE_COUNTER(name) Counter name(#name);
+#define GJS_DEFINE_COUNTER(name, ix) Counter name(#name);
-GJS_DEFINE_COUNTER(everything)
+GJS_DEFINE_COUNTER(everything, -1)
GJS_FOR_EACH_COUNTER(GJS_DEFINE_COUNTER)
} // namespace Counters
} // namespace Memory
} // namespace Gjs
-#define GJS_LIST_COUNTER(name) &Gjs::Memory::Counters::name,
+#define GJS_LIST_COUNTER(name, ix) &Gjs::Memory::Counters::name,
static Gjs::Memory::Counter* counters[] = {
GJS_FOR_EACH_COUNTER(GJS_LIST_COUNTER)};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]