mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 08:41:02 +08:00
(profiler reader app) Setting file name manually when launching application without arguments
This commit is contained in:
parent
3017be305a
commit
cae3ab989e
@ -74,25 +74,43 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
::profiler::thread_blocks_tree_t threaded_trees;
|
::profiler::thread_blocks_tree_t threaded_trees;
|
||||||
|
|
||||||
const char* filename = nullptr;
|
::std::string filename;
|
||||||
if(argc > 1 && argv[1]){
|
if(argc > 1 && argv[1])
|
||||||
|
{
|
||||||
filename = argv[1];
|
filename = argv[1];
|
||||||
}else{
|
}
|
||||||
std::cout << "Specify prof file!" << std::endl;
|
else
|
||||||
return 255;
|
{
|
||||||
|
std::cout << "Specify prof file: ";
|
||||||
|
std::getline(std::cin, filename);
|
||||||
|
//return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* dump_filename = nullptr;
|
::std::string dump_filename;
|
||||||
if(argc > 2 && argv[2]){
|
if(argc > 2 && argv[2])
|
||||||
|
{
|
||||||
dump_filename = argv[2];
|
dump_filename = argv[2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Specify output prof file: ";
|
||||||
|
std::getline(std::cin, dump_filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_filename.size() > 2)
|
||||||
|
{
|
||||||
PROFILER_ENABLE
|
PROFILER_ENABLE
|
||||||
std::cout << "Will dump reader prof file to " << dump_filename << std::endl;
|
std::cout << "Will dump reader prof file to " << dump_filename << std::endl;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dump_filename.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
auto start = std::chrono::system_clock::now();
|
auto start = std::chrono::system_clock::now();
|
||||||
|
|
||||||
auto blocks_counter = fillTreesFromFile(filename, threaded_trees, true);
|
auto blocks_counter = fillTreesFromFile(filename.c_str(), threaded_trees, true);
|
||||||
|
|
||||||
auto end = std::chrono::system_clock::now();
|
auto end = std::chrono::system_clock::now();
|
||||||
|
|
||||||
@ -103,9 +121,10 @@ int main(int argc, char* argv[])
|
|||||||
std::cout << std::string(20, '=') << " thread "<< i.first << " "<< std::string(20, '=') << std::endl;
|
std::cout << std::string(20, '=') << " thread "<< i.first << " "<< std::string(20, '=') << std::endl;
|
||||||
printTree(p, i.second.tree,-1);
|
printTree(p, i.second.tree,-1);
|
||||||
}
|
}
|
||||||
if(dump_filename!=nullptr)
|
|
||||||
|
if(!dump_filename.empty())
|
||||||
{
|
{
|
||||||
auto bcount = profiler::dumpBlocksToFile(dump_filename);
|
auto bcount = profiler::dumpBlocksToFile(dump_filename.c_str());
|
||||||
|
|
||||||
std::cout << "Blocks count for reader: " << bcount << std::endl;
|
std::cout << "Blocks count for reader: " << bcount << std::endl;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user