Skip to content

Commit

Permalink
Provide comma-separated list of all process names
Browse files Browse the repository at this point in the history
  • Loading branch information
petervdonovan committed Mar 28, 2024
1 parent 0b88521 commit a637ff0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ define(_LF_CLOCK_SYNC_EXCHANGES_PER_INTERVAL)
define(_LF_CLOCK_SYNC_INITIAL)
define(_LF_CLOCK_SYNC_ON)
define(_LF_CLOCK_SYNC_PERIOD_NS)
define(_LF_FEDERATE_NAMES_COMMA_SEPARATED)
define(ADVANCE_MESSAGE_INTERVAL)
define(EXECUTABLE_PREAMBLE)
define(FEDERATED_CENTRALIZED)
Expand Down
2 changes: 1 addition & 1 deletion core/federated/RTI/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ int main(int argc, const char* argv[]) {
// sync thread. Add 1 for the thread that responds to erroneous
// connections attempted after initialization phase has completed. Add 1
// for the main thread.
lf_tracing_global_init("rti", -1, _lf_number_of_workers * 2 + 3);
lf_tracing_global_init("rti", NULL, -1, _lf_number_of_workers * 2 + 3);
lf_print("Tracing the RTI execution in %s file.", rti_trace_file_name);
}

Expand Down
4 changes: 2 additions & 2 deletions core/reactor_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,9 @@ void initialize_global(void) {
// -- threads are spawned to listen to upstream federates. Add 1 for the
// clock sync thread and add 1 for the staa thread
max_threads_tracing += NUMBER_OF_FEDERATES + 2;
lf_tracing_global_init(envs[0].name, FEDERATE_ID, max_threads_tracing);
lf_tracing_global_init(envs[0].name, _LF_FEDERATE_NAMES_COMMA_SEPARATED, FEDERATE_ID, max_threads_tracing);
#else
lf_tracing_global_init("trace", 0, max_threads_tracing);
lf_tracing_global_init("main", NULL, 0, max_threads_tracing);
#endif
// Call the code-generated function to initialize all actions, timers, and ports
// This is done for all environments/enclaves at the same time.
Expand Down
5 changes: 3 additions & 2 deletions include/core/tracepoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ static inline void tracepoint_federate_from_federate(trace_event_t event_type, i
(void)partner_id;
(void)tag;
}
static inline void lf_tracing_global_init(char* file_name_prefix, int process_id, int max_num_local_threads) {
(void)file_name_prefix;
static inline void lf_tracing_global_init(char* process_name, char* process_names, int process_id, int max_num_local_threads) {
(void)process_name;
(void)process_names;
(void)process_id;
(void)max_num_local_threads;
}
Expand Down
4 changes: 3 additions & 1 deletion trace/api/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ typedef struct {
* calling this procedure is undefined behavior.
*
* @param process_name The name of the current federate, or a placeholder if this is not a federate.
* @param process_names The names of all federates, separated by commas, or NULL
* if that information is not available.
* @param process_id The ID of the current federate, or -1 if this is the RTI. 0
* if unfederated.
* @param max_num_local_threads An upper bound on the number of threads created
* by this process.
*/
void lf_tracing_global_init(char* process_name, int process_id, int max_num_local_threads);
void lf_tracing_global_init(char* process_name, char* process_names, int process_id, int max_num_local_threads);
/**
* @brief Register a kind of trace event. This should be called before
* tracepoints are reached.
Expand Down
2 changes: 1 addition & 1 deletion trace/impl/src/trace_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void lf_tracing_tracepoint(int worker, trace_record_nodeps_t* tr) {
}
}

void lf_tracing_global_init(char* process_name, int fedid, int max_num_local_threads) {
void lf_tracing_global_init(char* process_name, char* process_names, int fedid, int max_num_local_threads) {
trace_mutex = lf_platform_mutex_new();
if (!trace_mutex) {
fprintf(stderr, "WARNING: Failed to initialize trace mutex.\n");
Expand Down

0 comments on commit a637ff0

Please sign in to comment.