Solving timestamps and serialization merge

Change-Id: Icd14e49c06b19e4334adbdb98efed54af029b95b


[ROCm/rocprofiler commit: def7fa710a]
This commit is contained in:
gobhardw
2023-08-24 17:45:22 +05:30
committed by Ammar Elwazir
parent 5e77e5008c
commit 6978569d1f
7 changed files with 189 additions and 88 deletions
@@ -20,6 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "test_utils.h"
#include <regex>
namespace rocprofiler {
namespace tests {
@@ -130,10 +131,6 @@ void tokenize_tracer_output(std::string line, tracer_kernel_info_t& kinfo) {
std::getline(tokenStream, token, ',');
kinfo.function = token;
std::getline(tokenStream, token, ',');
kinfo.operation = token;
std::getline(tokenStream, token, ',');
kinfo.kernel_name = token;
std::getline(tokenStream, token, ',');
kinfo.begin_time = token;
std::getline(tokenStream, token, ',');
kinfo.end_time = token;
@@ -145,6 +142,19 @@ void tokenize_tracer_output(std::string line, tracer_kernel_info_t& kinfo) {
kinfo.roxtx_msg = token;
}
// get numeric value of timestamp token
uint64_t get_timestamp_value(const std::string& str) {
std::regex pattern("(\\d+)");
std::smatch match;
if (regex_search(str, match, pattern)) {
return stoul(match[1]);
} else {
return -1;
}
}
} // namespace utility
} // namespace tests
} // namespace rocprofiler
@@ -27,6 +27,7 @@ THE SOFTWARE.
#include <execinfo.h> // for backtrace
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <fstream>
#include <sstream>
@@ -86,6 +87,9 @@ void tokenize_profiler_output(std::string line, profiler_kernel_info_t& kinfo);
// tokenize tracer output
void tokenize_tracer_output(std::string line, tracer_kernel_info_t& kinfo);
// get numeric value of timestamp token
uint64_t get_timestamp_value(const std::string& str);
} // namespace utility
} // namespace tests
} // namespace rocprofiler
@@ -94,6 +98,7 @@ void tokenize_tracer_output(std::string line, tracer_kernel_info_t& kinfo);
// path for executable
int main(int argc, char** argv);
using rocprofiler::tests::utility::get_timestamp_value;
using rocprofiler::tests::utility::GetNumberOfCores;
using rocprofiler::tests::utility::GetRunningPath;
using rocprofiler::tests::utility::is_installed_path;