summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchenzizhan <[email protected]>2023-11-09 10:45:02 +0800
committerchenzizhan <[email protected]>2023-11-09 10:45:02 +0800
commit4d86da7c364d5d17b07045984573e380dc5c9a8a (patch)
treeea29b5b321c8a0594f532967de4c7503d35ee30a
parent362cafb9317ea287db5744c2df6bc913a9350849 (diff)
padding elegantly
-rw-r--r--src/fieldstat_easy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fieldstat_easy.c b/src/fieldstat_easy.c
index b876e91..c4c0974 100644
--- a/src/fieldstat_easy.c
+++ b/src/fieldstat_easy.c
@@ -13,12 +13,12 @@
#include "fieldstat_exporter.h"
#include "fieldstat_easy.h"
+#define CACHE_LINE_SIZE 64
struct fs_easy_thread {
struct fieldstat *active;
struct fieldstat *read_only;
pthread_spinlock_t lock;
- char padding[40]; // to avoid false sharing. 40 = 64 - 8 - 8 - 8
-};
+} __attribute__((aligned(CACHE_LINE_SIZE)));
struct fieldstat_easy
{