Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reorganize structs to save a few bytes.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 24 Nov 2011 10:57:22 +0000 (11:57 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 28 Nov 2011 10:21:32 +0000 (11:21 +0100)
The general idea is to move the fields, in order to group pointers
apart from integers.  Thus, the padding between fields is reduced,
and the size of the struct is reduced too.

It can save up to 32 bytes per node (host and/or process) on 64bits
architectures.

include/simix/context.h
src/msg/msg_private.h
src/surf/cpu.c
src/surf/maxmin_private.h
src/surf/workstation_ptask_L07.c
src/xbt/log.c
src/xbt/mallocator_private.h

index 4b4d5b9..71d1e6d 100644 (file)
@@ -74,11 +74,11 @@ extern smx_context_t smx_current_context;
 typedef struct s_smx_context {
   s_xbt_swag_hookup_t hookup;
   xbt_main_func_t code;
-  int argc;
-  char **argv;
   void_pfn_smxprocess_t cleanup_func;
-  int iwannadie:1;
   void *data;   /* Here SIMIX stores the smx_process_t containing the context */
+  char **argv;
+  int argc;
+  int iwannadie:1;
 } s_smx_ctx_base_t;
 
 /* methods of this class */
index cf9f975..e8af564 100644 (file)
@@ -55,8 +55,8 @@ typedef struct simdata_process {
   m_channel_t put_channel;      /* used for debugging purposes */
   smx_action_t waiting_action;
   m_task_t waiting_task;
-  int argc;                     /* arguments number if any */
   char **argv;                  /* arguments table if any */
+  int argc;                     /* arguments number if any */
   MSG_error_t last_errno;       /* the last value returned by a MSG_function */
   void* data;                   /* user data */
 } s_simdata_process_t, *simdata_process_t;
index b0d69b5..443ae7e 100644 (file)
@@ -15,8 +15,8 @@ typedef struct cpu_Cas01 {
   s_surf_resource_t generic_resource;
   double power_peak;
   double power_scale;
-  int core;
   tmgr_trace_event_t power_event;
+  int core;
   e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
   lmm_constraint_t constraint;
index e4fe040..21370d7 100644 (file)
@@ -36,10 +36,10 @@ typedef struct lmm_constraint {
   double lambda;
   double new_lambda;
   double remaining;
-  int shared;
   double usage;
   void *id;
   int id_int;
+  int shared;
 } s_lmm_constraint_t;
 
 typedef struct lmm_variable {
index 4e5b3ff..b8ecc23 100644 (file)
@@ -26,8 +26,8 @@ typedef struct cpu_L07 {
   double power_scale;
   double power_current;
   tmgr_trace_event_t power_event;
-  e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
+  e_surf_resource_state_t state_current;
   int id;                       /* cpu and network card are a single object... */
 } s_cpu_L07_t, *cpu_L07_t;
 
index d772211..4bed85f 100644 (file)
@@ -473,8 +473,8 @@ xbt_log_layout_t xbt_log_default_layout = NULL; /* set in log_init */
 
 typedef struct {
   char *catname;
-  e_xbt_log_priority_t thresh;
   char *fmt;
+  e_xbt_log_priority_t thresh;
   int additivity;
   xbt_log_appender_t appender;
 } s_xbt_log_setting_t, *xbt_log_setting_t;
index 928b3e5..8748245 100644 (file)
@@ -10,8 +10,8 @@
 #define _XBT_MALLOCATOR_PRIVATE_H__
 
 typedef struct s_xbt_mallocator {
-  int current_size;             /* number of objects currently stored */
   void **objects;               /* objects stored by the mallocator and available for the user */
+  int current_size;             /* number of objects currently stored */
   int max_size;                 /* maximum number of objects */
   pvoid_f_void_t new_f;         /* function to call when we are running out of objects */
   void_f_pvoid_t free_f;        /* function to call when we have got too many objects */