11#pragma once
2- #include " chimbuko/ad/ADDefine.hpp"
2+ #include < chimbuko/ad/ADDefine.hpp>
3+ #include < chimbuko/ad/utils.hpp>
34#include < iostream>
45#include < string>
56#include < vector>
@@ -26,9 +27,9 @@ class Event_t {
2627 * @param data pointer to raw performance event vector
2728 * @param t event type
2829 * @param idx event index
29- * @param id event (string) id
30+ * @param id event id
3031 */
31- Event_t (const unsigned long * data, EventDataType t, size_t idx, std::string id= " event_id " )
32+ Event_t (const unsigned long * data, EventDataType t, size_t idx, const eventID &id = eventID() )
3233 : m_data(data), m_t (t), m_id(id), m_idx(idx) {}
3334 /* *
3435 * @brief Destroy the Event_t object
@@ -45,7 +46,7 @@ class Event_t {
4546 /* *
4647 * @brief return event id
4748 */
48- std::string id () const { return m_id; }
49+ const eventID & id () const { return m_id; }
4950 /* *
5051 * @brief return event index, typically the index of the event in the input array for the timestep on which it was spawned
5152 */
@@ -141,7 +142,7 @@ class Event_t {
141142private:
142143 const unsigned long * m_data; /* *< pointer to raw performance trace data vector */
143144 EventDataType m_t ; /* *< event type */
144- std::string m_id; /* *< event id */
145+ eventID m_id; /* *< event id */
145146 size_t m_idx; /* *< event index */
146147};
147148
@@ -172,7 +173,7 @@ class CommData_t {
172173 * @param ev constant reference to a Event_t object
173174 * @param commType communication type (e.g. SEND/RECV)
174175 */
175- CommData_t (const Event_t& ev, std::string commType);
176+ CommData_t (const Event_t& ev, const std::string & commType);
176177 /* *
177178 * @brief Destroy the CommData_t object
178179 *
@@ -206,12 +207,12 @@ class CommData_t {
206207 *
207208 * @param key execution id
208209 */
209- void set_exec_key (std::string key) { m_execkey = key; }
210+ void set_exec_key (const eventID & key) { m_execkey = key; }
210211
211212 /* *
212213 * @brief Get the execution key id. This is equal to the "id" string associated with a parent ExecData_t object
213214 */
214- const std::string & get_exec_key () const { return m_execkey; }
215+ const eventID & get_exec_key () const { return m_execkey; }
215216
216217 /* *
217218 * @brief compare two communication data
@@ -239,7 +240,7 @@ class CommData_t {
239240 m_bytes, /* *< communication data size in bytes */
240241 m_tag; /* *< communication tag */
241242 unsigned long m_ts; /* *< communication timestamp */
242- std::string m_execkey; /* *< execution key (or id) where this communication event occurs */
243+ eventID m_execkey; /* *< execution key (or id) where this communication event occurs */
243244};
244245
245246
@@ -306,12 +307,12 @@ class CommData_t {
306307 *
307308 * @param key execution id
308309 */
309- void set_exec_key (std::string key) { m_execkey = key; }
310+ void set_exec_key (const eventID & key) { m_execkey = key; }
310311
311312 /* *
312313 * @brief Get the execution key id. This is equal to the "id" string associated with a parent ExecData_t object
313314 */
314- const std::string & get_exec_key () const { return m_execkey; }
315+ const eventID & get_exec_key () const { return m_execkey; }
315316
316317 private:
317318 std::string m_countername; /* *< counter name */
@@ -322,7 +323,7 @@ class CommData_t {
322323 m_cid, /* *< counted id */
323324 m_value, /* *< counter value */
324325 m_ts; /* *< counter timestamp */
325- std::string m_execkey; /* *< execution key (or id) where this counter event occurs */
326+ eventID m_execkey; /* *< execution key (or id) where this counter event occurs */
326327 };
327328
328329
@@ -355,7 +356,7 @@ class ExecData_t {
355356 /* *
356357 * @brief Get the id of this execution data
357358 */
358- const std::string &get_id () const { return m_id; }
359+ const eventID &get_id () const { return m_id; }
359360 /* *
360361 * @brief Get the function name of this execution data
361362 */
@@ -405,7 +406,7 @@ class ExecData_t {
405406 /* *
406407 * @brief Get the parent function id of this execution data
407408 */
408- std::string get_parent () const { return m_parent; }
409+ const eventID & get_parent () const { return m_parent; }
409410 /* *
410411 * @brief Get a list of communication data occured in this execution data
411412 */
@@ -441,7 +442,7 @@ class ExecData_t {
441442 *
442443 * @param parent the parent execution id
443444 */
444- void set_parent (std::string parent) { m_parent = parent; }
445+ void set_parent (const eventID & parent) { m_parent = parent; }
445446 /* *
446447 * @brief Set the function name of this execution
447448 *
@@ -521,7 +522,7 @@ class ExecData_t {
521522 /* *
522523 * @brief Set the partner event linked by a GPU correlation ID
523524 */
524- void set_GPU_correlationID_partner (const std::string event_id){ m_gpu_correlation_id_partner.push_back (event_id); }
525+ void set_GPU_correlationID_partner (const eventID & event_id){ m_gpu_correlation_id_partner.push_back (event_id); }
525526
526527 /* *
527528 * @brief Return true if this event has been matched to a partner event by a GPU correlation ID
@@ -539,10 +540,10 @@ class ExecData_t {
539540 *
540541 * Throws error if index out of range
541542 */
542- const std::string & get_GPU_correlationID_partner (const size_t i) const ;
543+ const eventID & get_GPU_correlationID_partner (const size_t i) const ;
543544
544545private:
545- std::string m_id; /* *< execution id */
546+ eventID m_id; /* *< execution id */
546547 std::string m_funcname; /* *< function name */
547548 unsigned long
548549 m_pid, /* *< program id */
@@ -555,13 +556,13 @@ class ExecData_t {
555556 m_runtime, /* *< inclusive running time (i.e. including time of child calls) */
556557 m_exclusive; /* *< exclusive running time (i.e. excluding time of child calls) */
557558 int m_label; /* *< 1 for normal, -1 for abnormal execution */
558- std::string m_parent; /* *< parent execution */
559+ eventID m_parent; /* *< parent execution */
559560 unsigned long m_n_children; /* *< the number of childrent executions */
560561 unsigned long m_n_messages; /* *< the number of messages */
561562 std::deque<CommData_t> m_messages; /* *< a vector of all messages */
562563 std::deque<CounterData_t> m_counters; /* *< a vector of all counters */
563564 bool m_can_delete; /* *< Flag indicating that the event is deletable by the garbage collection */
564- std::vector<std::string > m_gpu_correlation_id_partner; /* *< The event ids partner events linked by a correlation ID, either the launching CPU event or the GPU kernel event */
565+ std::vector<eventID > m_gpu_correlation_id_partner; /* *< The event ids partner events linked by a correlation ID, either the launching CPU event or the GPU kernel event */
565566};
566567
567568
0 commit comments