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 @@ ...@@ -2,7 +2,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> // #include <map>
#include <chrono> #include <chrono>
#include "Jikan.h" #include "Jikan.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
//------------------------- Jikan-config --------------------------------------------- //------------------------- Jikan-config ---------------------------------------------
#define TIMER_ON #define TIMER_ON
// #define INCLUDE_GPU_TIMER #define INCLUDE_GPU_TIMER
#define INCLUDE_MPI #define INCLUDE_MPI
// #define INCLUDE_OPEN_MP // #define INCLUDE_OPEN_MP
// #define SAVE_TIME_SERIES // #define SAVE_TIME_SERIES
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "ToJSON.h" #include "ToJSON.h"
#include <iostream> #include <iostream>
#include <map> // #include <map>
#include <string> #include <string>
#ifdef INCLUDE_OPEN_MP #ifdef INCLUDE_OPEN_MP
...@@ -86,7 +86,7 @@ Jikan::~Jikan() ...@@ -86,7 +86,7 @@ Jikan::~Jikan()
#endif #endif
this->Events.clear(); 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) for(it = this->EventType.begin(); it!=this->EventType.end(); ++it)
it->second.clear(); it->second.clear();
...@@ -99,7 +99,7 @@ Jikan::~Jikan() ...@@ -99,7 +99,7 @@ Jikan::~Jikan()
bool Jikan::ifContains(const string& Name) bool Jikan::ifContains(const string& Name)
{ {
map<string, EventData>::iterator it; unordered_map<string, EventData>::iterator it;
it = this->Events.find(Name); it = this->Events.find(Name);
if (it == this->Events.end()) if (it == this->Events.end())
...@@ -287,21 +287,26 @@ void Jikan::GenerateTypedOutputData(const string& EventType, string& EventTypeSt ...@@ -287,21 +287,26 @@ void Jikan::GenerateTypedOutputData(const string& EventType, string& EventTypeSt
void Jikan::GenerateOutputData() void Jikan::GenerateOutputData()
{ {
map<string, set<string> >::iterator it; unordered_map<string, set<string> >::iterator it;
map<string, set<string> >::iterator end_m = this->EventType.end(); unordered_map<string, set<string> >::iterator end_m; // = this->EventType.end();
--end_m; // end_m--;
string Name; string Name;
string Out = "{ "; string Out = "{ ";
string TypedOutput; 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; Name = it->first;
TypedOutput = ""; TypedOutput = "";
this->GenerateTypedOutputData(Name, TypedOutput); this->GenerateTypedOutputData(Name, TypedOutput);
Out += TypedOutput + ",\n"; Out += TypedOutput + ",\n";
} }
else
end_m = it;
}
Name = end_m->first; Name = end_m->first;
TypedOutput = ""; TypedOutput = "";
......
...@@ -42,3 +42,4 @@ void Jikan::CUDAGetTime(const string& name, const int cont_mode_t) ...@@ -42,3 +42,4 @@ void Jikan::CUDAGetTime(const string& name, const int cont_mode_t)
} }
#endif #endif
} }
#endif
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <set> #include <set>
#include <unordered_map>
#ifdef INCLUDE_MPI #ifdef INCLUDE_MPI
#include <mpi.h> #include <mpi.h>
...@@ -14,8 +15,8 @@ ...@@ -14,8 +15,8 @@
class Jikan class Jikan
{ {
public: public:
std::map<std::string, EventData> Events; // Measuring code blocks info: string = code block name ID, EventData = measuring code block data std::unordered_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, std::set<std::string> > EventType; // Code blocks measurment types: synchronious or ansynchronious
std::string JSONname; // Measurments dump filename std::string JSONname; // Measurments dump filename
std::string JSONdata; // Dump string std::string JSONdata; // Dump string
std::string Error; // Dump error ? 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