Defines the structures and functions used by MSUs on the local machine. More...
#include "local_msu.h"#include "routing_strategies.h"#include "logging.h"#include "rt_stats.h"#include "msu_message.h"#include "inter_runtime_messages.h"#include "thread_message.h"#include "msu_state.h"#include "msu_calls.h"#include <stdlib.h>#include <sys/resource.h>#include <sys/time.h>Go to the source code of this file.
Macros | |
| #define | __USE_GNU |
| #define | MAX_MSU_ID 1024 |
| MOVEME: MAX_MSU_ID Defines the maximum ID that can be assigned to an MSU. More... | |
| #define | NUM_MSU_STAT_IDS sizeof(MSU_STAT_IDS) / sizeof(enum stat_id) |
| #define | RECORD_DIFF(dstat, rstat, id) increment_stat(dstat, id, after.rstat - before->rstat) |
| #define | RECORD_TIMEDIFF(dstat, rstat, id) |
Functions | |
| static struct local_msu * | msu_alloc () |
| Allocates the memory associated with an MSU structure. More... | |
| static void | msu_free (struct local_msu *msu) |
| Frees the memory associated with an MSU structure, including any routes, messages in its queue, or states. More... | |
| static int | rm_from_local_registry (int id) |
| Removes an MSU from the local MSU registry. More... | |
| static int | add_to_local_registry (struct local_msu *msu) |
| Adds an MSU to the local registry so it can be referred to elsewhere by ID. More... | |
| struct local_msu * | get_local_msu (unsigned int id) |
| Gets the local MSU with the given ID, or NULL if N/A. More... | |
| static void | init_msu_stats (int msu_id) |
| Initializes the stat IDS that are relevant to an MSU. More... | |
| static void | unregister_msu_stats (int msu_id) |
| Unregisters the stat IDS that are relevant to an MSU. More... | |
| struct local_msu * | init_msu (unsigned int id, struct msu_type *type, struct worker_thread *thread, struct msu_init_data *data) |
| Allocates and creates a new MSU of the specified type and ID on the given thread. More... | |
| int | try_destroy_msu (struct local_msu *msu) |
| Destroys the MSU, but only if it has no states currently saved. More... | |
| void | destroy_msu (struct local_msu *msu) |
| Calls type-specific destroy function and frees associated memory. More... | |
| static int | msu_receive (struct local_msu *msu, struct msu_msg *msg) |
| Calls type-specific MSU receive function and records execution time. More... | |
| static int | gather_metrics_before (struct rusage *before) |
| static void | record_metrics (struct rusage *before, int msu_id) |
| int | msu_dequeue (struct local_msu *msu) |
| Dequeus a message from a local MSU and calls its receive function. More... | |
| int | msu_error (struct local_msu *msu, struct msu_msg_hdr *hdr, int broadcast) |
Variables | |
| pthread_rwlock_t | msu_registry_lock |
| Lock to protect access to local msu registry. More... | |
| struct local_msu * | local_msu_registry [1024] |
| Mapping of MSU ID to the specific instance of the local MSU. More... | |
| static enum stat_id | MSU_STAT_IDS [] |
| The stat IDs that are associated with an MSU, to be registered on MSU creation. More... | |
Defines the structures and functions used by MSUs on the local machine.
Definition in file local_msu.c.
| #define __USE_GNU |
Definition at line 36 of file local_msu.c.
| #define MAX_MSU_ID 1024 |
MOVEME: MAX_MSU_ID Defines the maximum ID that can be assigned to an MSU.
Necessary becaues MSUs are indexed by ID in the local registry.
Definition at line 44 of file local_msu.c.
| #define NUM_MSU_STAT_IDS sizeof(MSU_STAT_IDS) / sizeof(enum stat_id) |
Definition at line 171 of file local_msu.c.
| #define RECORD_DIFF | ( | dstat, | |
| rstat, | |||
| id | |||
| ) | increment_stat(dstat, id, after.rstat - before->rstat) |
Definition at line 299 of file local_msu.c.
| #define RECORD_TIMEDIFF | ( | dstat, | |
| rstat, | |||
| id | |||
| ) |
Definition at line 302 of file local_msu.c.
|
static |
Adds an MSU to the local registry so it can be referred to elsewhere by ID.
| MSU | the local MSU to add to the registry |
Definition at line 114 of file local_msu.c.
| void destroy_msu | ( | struct local_msu * | msu | ) |
Calls type-specific destroy function and frees associated memory.
Definition at line 257 of file local_msu.c.
|
inlinestatic |
Definition at line 291 of file local_msu.c.
| struct local_msu* get_local_msu | ( | unsigned int | id | ) |
Gets the local MSU with the given ID, or NULL if N/A.
| id | ID of the MSU to retrieve |
Definition at line 134 of file local_msu.c.
| struct local_msu* init_msu | ( | unsigned int | id, |
| struct msu_type * | type, | ||
| struct worker_thread * | thread, | ||
| struct msu_init_data * | data | ||
| ) |
Allocates and creates a new MSU of the specified type and ID on the given thread.
| id | ID of the MSU to be created |
| type | MSU type of the MSU to be created |
| thread | The thread on which this MSU is to be created |
| data | Any initial data that is passed to the MSU's specific init function |
Definition at line 198 of file local_msu.c.
|
static |
Initializes the stat IDS that are relevant to an MSU.
| msu_id | ID of the msu to register |
Definition at line 177 of file local_msu.c.
|
static |
Allocates the memory associated with an MSU structure.
Definition at line 58 of file local_msu.c.
| int msu_dequeue | ( | struct local_msu * | msu | ) |
Dequeus a message from a local MSU and calls its receive function.
| msu | MSU to dequeue the message from |
Definition at line 323 of file local_msu.c.
| int msu_error | ( | struct local_msu * | msu, |
| struct msu_msg_hdr * | hdr, | ||
| int | broadcast | ||
| ) |
Definition at line 353 of file local_msu.c.
|
static |
Frees the memory associated with an MSU structure, including any routes, messages in its queue, or states.
Definition at line 71 of file local_msu.c.
Calls type-specific MSU receive function and records execution time.
| msu | MSU to receive data |
| data | Data to be sent to MSU |
Definition at line 275 of file local_msu.c.
|
inlinestatic |
Definition at line 306 of file local_msu.c.
|
static |
Removes an MSU from the local MSU registry.
| id | ID of the MSU to remove |
Definition at line 90 of file local_msu.c.
| int try_destroy_msu | ( | struct local_msu * | msu | ) |
Destroys the MSU, but only if it has no states currently saved.
Definition at line 249 of file local_msu.c.
|
static |
Unregisters the stat IDS that are relevant to an MSU.
| msu_id | ID of the MSU to register |
Definition at line 189 of file local_msu.c.
| struct local_msu* local_msu_registry[1024] |
Mapping of MSU ID to the specific instance of the local MSU.
Definition at line 52 of file local_msu.c.
| pthread_rwlock_t msu_registry_lock |
Lock to protect access to local msu registry.
Definition at line 50 of file local_msu.c.
|
static |
The stat IDs that are associated with an MSU, to be registered on MSU creation.
Definition at line 155 of file local_msu.c.
1.8.6