0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-28 17:28:14 +08:00
Victor Zarubkin 55cd5a5751 (profiler Reader) For memory consumption optimization created BlocksTreeRoot class and move thread_name field from BlocksTree to new created class;
(profiler Reader) Added self_duration field for statistics;
(profiler Reader) Removed #ifdef macros;
(profiler Reader) moved BlocksTree, BlocksTreeRoot and thread_blocks_tree_t types inside profiler namespace;
(profiler GUI) Added globals.h and globals.cpp containing global variables and signals; Added profiler_gui namespace;
(ProfTreeWidget) Added context menu "Select columns" to make it possible to hide columns;
(ProfTreeWidget) Added percent statistics for blocks (Self %, Parent % and Frame %); Added displaying of total thread duration;
(ProfGraphicsScrollbar) Added context menu to make it possible to choose which thread to display on minimap;
(ProfGraphicsView) Highlighting currently selected thread;
2016-08-03 23:00:04 +03:00

83 lines
1.8 KiB
C++

#include <QApplication>
#include <QTreeView>
#include <QFileSystemModel>
#include <chrono>
#include "treemodel.h"
#include "blocks_graphics_view.h"
#include "blocks_tree_widget.h"
#include "main_window.h"
#include "profiler/reader.h"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
//QFileSystemModel *model = new QFileSystemModel;
//model->setRootPath(QDir::currentPath());
// const char* filename = 0;
// if(argc > 1 && argv[1]){
// filename = argv[1];
// }else{
// return 255;
// }
// QFile file(filename);
// file.open(QIODevice::ReadOnly);
// TreeModel model(file.readAll());
// file.close();
// QTreeView *tree = new QTreeView();
// tree->setModel(&model);
//
// tree->show();
auto now = ::std::chrono::duration_cast<std::chrono::seconds>(::std::chrono::system_clock::now().time_since_epoch()).count() >> 1;
srand((unsigned int)now);
int mode = 2;
switch (mode)
{
case 0:
{
const bool test = false;
if (test)
{
ProfGraphicsView gview(true);
gview.show();
return app.exec();
}
::profiler::thread_blocks_tree_t threaded_trees;
fillTreesFromFile("test.prof", threaded_trees, true);
ProfGraphicsView gview(threaded_trees);
gview.show();
return app.exec();
}
case 1:
{
::profiler::thread_blocks_tree_t threaded_trees;
auto nblocks = fillTreesFromFile("test.prof", threaded_trees, true);
ProfTreeWidget view(nblocks, threaded_trees);
view.show();
return app.exec();
}
case 2:
{
ProfMainWindow window;
window.show();
return app.exec();
}
}
return -1;
}