Skip to content
Snippets Groups Projects
Commit cff042c0 authored by 数学の武士's avatar 数学の武士
Browse files

unordered_map

parent a34210a3
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
#include <string>
#include <vector>
#include <map>
// #include <map>
#include <chrono>
#include "Jikan.h"
......
......@@ -2,7 +2,7 @@
//------------------------- Jikan-config ---------------------------------------------
#define TIMER_ON
// #define INCLUDE_GPU_TIMER
#define INCLUDE_GPU_TIMER
#define INCLUDE_MPI
// #define INCLUDE_OPEN_MP
// #define SAVE_TIME_SERIES
......
......@@ -3,7 +3,7 @@
#include "ToJSON.h"
#include <iostream>
#include <map>
// #include <map>
#include <string>
#ifdef INCLUDE_OPEN_MP
......@@ -86,7 +86,7 @@ Jikan::~Jikan()
#endif
this->Events.clear();
map<string, set<string> >::iterator it;
unordered_map<string, set<string> >::iterator it;
for(it = this->EventType.begin(); it!=this->EventType.end(); ++it)
it->second.clear();
......@@ -99,7 +99,7 @@ Jikan::~Jikan()
bool Jikan::ifContains(const string& Name)
{
map<string, EventData>::iterator it;
unordered_map<string, EventData>::iterator it;
it = this->Events.find(Name);
if (it == this->Events.end())
......@@ -287,21 +287,26 @@ void Jikan::GenerateTypedOutputData(const string& EventType, string& EventTypeSt
void Jikan::GenerateOutputData()
{
map<string, set<string> >::iterator it;
map<string, set<string> >::iterator end_m = this->EventType.end();
--end_m;
unordered_map<string, set<string> >::iterator it;
unordered_map<string, set<string> >::iterator end_m; // = this->EventType.end();
// end_m--;
string Name;
string Out = "{ ";
string TypedOutput;
for(it = this->EventType.begin(); it!=end_m; ++it)
for(it = this->EventType.begin(); it!=this->EventType.end(); ++it)
{
if(next(it) != this->EventType.end())
{
Name = it->first;
TypedOutput = "";
this->GenerateTypedOutputData(Name, TypedOutput);
Out += TypedOutput + ",\n";
}
else
end_m = it;
}
Name = end_m->first;
TypedOutput = "";
......
......@@ -42,3 +42,4 @@ void Jikan::CUDAGetTime(const string& name, const int cont_mode_t)
}
#endif
}
#endif
\ No newline at end of file
......@@ -6,6 +6,7 @@
#include <iostream>
#include <string>
#include <set>
#include <unordered_map>
#ifdef INCLUDE_MPI
#include <mpi.h>
......@@ -14,8 +15,8 @@
class Jikan
{
public:
std::map<std::string, EventData> Events; // Measuring code blocks info: string = code block name ID, EventData = measuring code block data
std::map<std::string, std::set<std::string> > EventType; // Code blocks measurment types: synchronious or ansynchronious
std::unordered_map<std::string, EventData> Events; // Measuring code blocks info: string = code block name ID, EventData = measuring code block data
std::unordered_map<std::string, std::set<std::string> > EventType; // Code blocks measurment types: synchronious or ansynchronious
std::string JSONname; // Measurments dump filename
std::string JSONdata; // Dump string
std::string Error; // Dump error ?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment