Skip to content

Commit b144cfc

Browse files
GermanAizekBenBE
andcommitted
Align structures 8 byte for 64-bit platforms
references: - https://hpc.rz.rptu.de/Tutorials/AVX/alignment.shtml - https://wr.informatik.uni-hamburg.de/_media/teaching/wintersemester_2013_2014/epc-14-haase-svenhendrik-alignmentinc-presentation.pdf - https://en.wikipedia.org/wiki/Data_structure_alignment - https://stackoverflow.com/a/20882083 - https://zijishi.xyz/post/optimization-technique/learning-to-use-data-alignment/ affected structs: - ScreenManager 72 to 64 bytes - Screen/DynamicIterator 24 to 16 bytes - Meter/DynamicIterator 24 to 16 bytes - IncMode 152 to 144 bytes - TraceScreen 64 to 56 bytes - LinuxProcessTable 120 to 112 bytes - FunctionBar 40 to 32 bytes Co-authored-by: BenBE <[email protected]>
1 parent 1c31e21 commit b144cfc

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

DynamicMeter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ void DynamicMeters_delete(Hashtable* dynamics) {
4848
}
4949

5050
typedef struct {
51-
ht_key_t key;
5251
const char* name;
52+
ht_key_t key;
5353
bool found;
5454
} DynamicIterator;
5555

DynamicScreen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ void DynamicScreen_done(DynamicScreen* this) {
3939
}
4040

4141
typedef struct {
42-
ht_key_t key;
4342
const char* name;
43+
ht_key_t key;
4444
bool found;
4545
} DynamicIterator;
4646

FunctionBar.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ in the source distribution for its full text.
1111

1212

1313
typedef struct FunctionBar_ {
14-
int size;
14+
uint32_t size;
15+
bool staticData;
1516
char** functions;
1617
union {
1718
char** keys;
1819
const char* const* constKeys;
1920
} keys;
2021
int* events;
21-
bool staticData;
2222
} FunctionBar;
2323

2424
#define FUNCTIONBAR_MAXEVENTS 15

IncSet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ typedef enum {
2424

2525
typedef struct IncMode_ {
2626
char buffer[INCMODE_MAX + 1];
27-
size_t index;
2827
FunctionBar* bar;
28+
uint32_t index;
2929
bool isFilter;
3030
} IncMode;
3131

ScreenManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ typedef struct ScreenManager_ {
2121
int y1;
2222
int x2;
2323
int y2;
24+
bool allowFocusChange;
25+
uint32_t panelCount;
2426
Vector* panels;
2527
const char* name;
26-
int panelCount;
2728
Header* header;
2829
Machine* host;
2930
State* state;
30-
bool allowFocusChange;
3131
} ScreenManager;
3232

3333
ScreenManager* ScreenManager_new(Header* header, Machine* host, State* state, bool owner);

TraceScreen.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ in the source distribution for its full text.
1818

1919
typedef struct TraceScreen_ {
2020
InfoScreen super;
21-
bool tracing;
22-
pid_t child;
2321
FILE* strace;
22+
pid_t child;
23+
bool tracing;
2424
bool contLine;
2525
bool follow;
2626
bool strace_alive;

linux/LinuxProcessTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ typedef struct LinuxProcessTable_ {
2727
bool haveAutogroup;
2828

2929
#ifdef HAVE_DELAYACCT
30-
struct nl_sock* netlink_socket;
3130
int netlink_family;
31+
struct nl_sock* netlink_socket;
3232
#endif
3333
} LinuxProcessTable;
3434

0 commit comments

Comments
 (0)