mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-26 08:01:51 +08:00
Replace tab to whitespaces
This commit is contained in:
parent
ede383be3c
commit
68ee40a5ad
@ -134,7 +134,7 @@ EasyTreeWidget::EasyTreeWidget(QWidget* _parent)
|
||||
|
||||
EasyTreeWidget::~EasyTreeWidget()
|
||||
{
|
||||
saveSettings();
|
||||
saveSettings();
|
||||
delete m_progress;
|
||||
}
|
||||
|
||||
@ -298,10 +298,10 @@ void EasyTreeWidget::clearSilent(bool _global)
|
||||
for (int i = topLevelItemCount() - 1; i >= 0; --i)
|
||||
topLevelItems.push_back(takeTopLevelItem(i));
|
||||
|
||||
auto deleter_thread = ::std::thread([](decltype(topLevelItems) _items) {
|
||||
for (auto item : _items)
|
||||
delete item;
|
||||
}, ::std::move(topLevelItems));
|
||||
auto deleter_thread = ::std::thread([](decltype(topLevelItems) _items) {
|
||||
for (auto item : _items)
|
||||
delete item;
|
||||
}, ::std::move(topLevelItems));
|
||||
deleter_thread.detach();
|
||||
|
||||
//clear();
|
||||
@ -403,12 +403,12 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
|
||||
auto hidemenu = menu.addMenu("Select columns");
|
||||
auto hdr = headerItem();
|
||||
|
||||
for (int i = 0; i < COL_COLUMNS_NUMBER; ++i)
|
||||
for (int i = 0; i < COL_COLUMNS_NUMBER; ++i)
|
||||
{
|
||||
auto columnAction = new QAction(hdr->text(i), nullptr);
|
||||
columnAction->setData(i);
|
||||
columnAction->setCheckable(true);
|
||||
columnAction->setChecked(!isColumnHidden(i));
|
||||
columnAction->setChecked(!isColumnHidden(i));
|
||||
connect(columnAction, &QAction::triggered, this, &This::onHideShowColumn);
|
||||
hidemenu->addAction(columnAction);
|
||||
}
|
||||
@ -434,7 +434,7 @@ void EasyTreeWidget::moveEvent(QMoveEvent* _event)
|
||||
|
||||
void EasyTreeWidget::alignProgressBar()
|
||||
{
|
||||
auto pos = mapToGlobal(rect().center());
|
||||
auto pos = mapToGlobal(rect().center());
|
||||
m_progress->move(pos.x() - (m_progress->width() >> 1), pos.y() - (m_progress->height() >> 1));
|
||||
}
|
||||
|
||||
@ -694,17 +694,17 @@ void EasyTreeWidget::loadSettings()
|
||||
|
||||
void EasyTreeWidget::saveSettings()
|
||||
{
|
||||
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
|
||||
settings.beginGroup("tree_widget");
|
||||
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
|
||||
settings.beginGroup("tree_widget");
|
||||
|
||||
settings.setValue("color_rows", m_bColorRows);
|
||||
settings.setValue("color_rows", m_bColorRows);
|
||||
|
||||
for (int i = 0; i < columnCount(); i++)
|
||||
{
|
||||
settings.setValue(QString("Column") + QString::number(i) , isColumnHidden(i));
|
||||
}
|
||||
for (int i = 0; i < columnCount(); i++)
|
||||
{
|
||||
settings.setValue(QString("Column") + QString::number(i) , isColumnHidden(i));
|
||||
}
|
||||
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -117,7 +117,7 @@ private slots:
|
||||
protected:
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
void saveSettings();
|
||||
void alignProgressBar();
|
||||
|
||||
}; // END of class EasyTreeWidget.
|
||||
|
@ -43,8 +43,8 @@
|
||||
|
||||
namespace profiler_gui {
|
||||
|
||||
const QString ORGANAZATION_NAME = "EasyProfiler";
|
||||
const QString APPLICATION_NAME = "Easy profiler gui application";
|
||||
const QString ORGANAZATION_NAME = "EasyProfiler";
|
||||
const QString APPLICATION_NAME = "Easy profiler gui application";
|
||||
|
||||
const QColor CHRONOMETER_COLOR = QColor::fromRgba(0x402020c0);
|
||||
const QRgb SELECTED_THREAD_BACKGROUND = 0x00e0e060;
|
||||
|
@ -39,27 +39,27 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
//QFileSystemModel *model = new QFileSystemModel;
|
||||
//model->setRootPath(QDir::currentPath());
|
||||
// const char* filename = 0;
|
||||
//QFileSystemModel *model = new QFileSystemModel;
|
||||
//model->setRootPath(QDir::currentPath());
|
||||
// const char* filename = 0;
|
||||
// if(argc > 1 && argv[1]){
|
||||
// filename = argv[1];
|
||||
// filename = argv[1];
|
||||
// }else{
|
||||
// return 255;
|
||||
// }
|
||||
// return 255;
|
||||
// }
|
||||
|
||||
// QFile file(filename);
|
||||
// file.open(QIODevice::ReadOnly);
|
||||
// file.open(QIODevice::ReadOnly);
|
||||
// TreeModel model(file.readAll());
|
||||
// file.close();
|
||||
// file.close();
|
||||
|
||||
|
||||
// QTreeView *tree = new QTreeView();
|
||||
// tree->setModel(&model);
|
||||
// QTreeView *tree = new QTreeView();
|
||||
// tree->setModel(&model);
|
||||
//
|
||||
// tree->show();
|
||||
// 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);
|
||||
|
@ -17,20 +17,20 @@
|
||||
* :
|
||||
* : *
|
||||
* ----------------- :
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : This program is free software : you can redistribute it and / or modify
|
||||
* : it under the terms of the GNU General Public License as published by
|
||||
* : the Free Software Foundation, either version 3 of the License, or
|
||||
* : (at your option) any later version.
|
||||
* :
|
||||
* : This program is distributed in the hope that it will be useful,
|
||||
* : but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* : GNU General Public License for more details.
|
||||
* :
|
||||
* : You should have received a copy of the GNU General Public License
|
||||
* license : Lightweight profiler library for c++
|
||||
* : Copyright(C) 2016 Sergey Yagovtsev, Victor Zarubkin
|
||||
* :
|
||||
* : This program is free software : you can redistribute it and / or modify
|
||||
* : it under the terms of the GNU General Public License as published by
|
||||
* : the Free Software Foundation, either version 3 of the License, or
|
||||
* : (at your option) any later version.
|
||||
* :
|
||||
* : This program is distributed in the hope that it will be useful,
|
||||
* : but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* : GNU General Public License for more details.
|
||||
* :
|
||||
* : You should have received a copy of the GNU General Public License
|
||||
* : along with this program.If not, see <http://www.gnu.org/licenses/>.
|
||||
************************************************************************/
|
||||
|
||||
@ -387,10 +387,10 @@ void EasyMainWindow::loadGeometry()
|
||||
|
||||
void EasyMainWindow::saveSettingsAndGeometry()
|
||||
{
|
||||
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
|
||||
settings.beginGroup("main");
|
||||
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
|
||||
settings.beginGroup("main");
|
||||
|
||||
settings.setValue("geometry", this->saveGeometry());
|
||||
settings.setValue("geometry", this->saveGeometry());
|
||||
settings.setValue("last_file", m_lastFile);
|
||||
settings.setValue("chrono_text_position", static_cast<int>(EASY_GLOBALS.chrono_text_position));
|
||||
settings.setValue("draw_graphics_items_borders", EASY_GLOBALS.draw_graphics_items_borders);
|
||||
@ -399,7 +399,7 @@ void EasyMainWindow::saveSettingsAndGeometry()
|
||||
settings.setValue("bind_scene_and_tree_expand_status", EASY_GLOBALS.bind_scene_and_tree_expand_status);
|
||||
settings.setValue("encoding", QTextCodec::codecForLocale()->name());
|
||||
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -127,7 +127,7 @@ private:
|
||||
|
||||
void loadSettings();
|
||||
void loadGeometry();
|
||||
void saveSettingsAndGeometry();
|
||||
void saveSettingsAndGeometry();
|
||||
|
||||
}; // END of class EasyMainWindow.
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
project(profiler_reader)
|
||||
|
||||
set(CPP_FILES
|
||||
main.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
${CPP_FILES}
|
||||
${CPP_FILES}
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
|
||||
if(UNIX)
|
||||
set(SPEC_LIB pthread)
|
||||
set(SPEC_LIB pthread)
|
||||
endif(UNIX)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} easy_profiler ${SPEC_LIB})
|
||||
|
@ -16,57 +16,57 @@
|
||||
|
||||
class TreePrinter
|
||||
{
|
||||
struct Info{
|
||||
std::string name;
|
||||
std::string info;
|
||||
};
|
||||
std::vector<Info> m_rows;
|
||||
struct Info{
|
||||
std::string name;
|
||||
std::string info;
|
||||
};
|
||||
std::vector<Info> m_rows;
|
||||
|
||||
public:
|
||||
TreePrinter(){
|
||||
TreePrinter(){
|
||||
|
||||
}
|
||||
void addNewRow(int level)
|
||||
{
|
||||
}
|
||||
void addNewRow(int level)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void printTree()
|
||||
{
|
||||
for (auto& row : m_rows){
|
||||
std::cout << row.name << " " << row.info << std::endl;
|
||||
}
|
||||
}
|
||||
void printTree()
|
||||
{
|
||||
for (auto& row : m_rows){
|
||||
std::cout << row.name << " " << row.info << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void printTree(TreePrinter& printer, const ::profiler::BlocksTree& tree, int level = 0, profiler::timestamp_t parent_dur = 0, profiler::timestamp_t root_dur = 0)
|
||||
{
|
||||
//
|
||||
//if (tree.node){
|
||||
// auto duration = tree.node->block()->duration();
|
||||
// float duration_ms = duration / 1e6f;
|
||||
// float percent = parent_dur ? float(duration) / float(parent_dur)*100.0f : 100.0f;
|
||||
// float rpercent = root_dur ? float(duration) / float(root_dur)*100.0f : 100.0f;
|
||||
// std::cout << std::string(level, '\t') << tree.node->getName()
|
||||
// << std::string(5 - level, '\t')
|
||||
// /*<< std::string(level, ' ')*/ << percent << "%| "
|
||||
// << rpercent << "%| "
|
||||
// << duration_ms << " ms"
|
||||
// << std::endl;
|
||||
// if (root_dur == 0){
|
||||
// root_dur = tree.node->block()->duration();
|
||||
// }
|
||||
//}
|
||||
//else{
|
||||
// root_dur = 0;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//if (tree.node){
|
||||
// auto duration = tree.node->block()->duration();
|
||||
// float duration_ms = duration / 1e6f;
|
||||
// float percent = parent_dur ? float(duration) / float(parent_dur)*100.0f : 100.0f;
|
||||
// float rpercent = root_dur ? float(duration) / float(root_dur)*100.0f : 100.0f;
|
||||
// std::cout << std::string(level, '\t') << tree.node->getName()
|
||||
// << std::string(5 - level, '\t')
|
||||
// /*<< std::string(level, ' ')*/ << percent << "%| "
|
||||
// << rpercent << "%| "
|
||||
// << duration_ms << " ms"
|
||||
// << std::endl;
|
||||
// if (root_dur == 0){
|
||||
// root_dur = tree.node->block()->duration();
|
||||
// }
|
||||
//}
|
||||
//else{
|
||||
// root_dur = 0;
|
||||
//}
|
||||
//
|
||||
|
||||
//for (const auto& i : tree.children){
|
||||
//for (const auto& i : tree.children){
|
||||
|
||||
// printTree(printer, i, level + 1, tree.node ? tree.node->block()->duration() : 0, root_dur);
|
||||
//}
|
||||
// printTree(printer, i, level + 1, tree.node ? tree.node->block()->duration() : 0, root_dur);
|
||||
//}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@ -120,9 +120,9 @@ int main(int argc, char* argv[])
|
||||
std::cout << "Blocks count: " << blocks_counter << std::endl;
|
||||
std::cout << "dT = " << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() << " usec" << std::endl;
|
||||
//for (const auto & i : threaded_trees){
|
||||
// TreePrinter p;
|
||||
// std::cout << std::string(20, '=') << " thread "<< i.first << " "<< std::string(20, '=') << std::endl;
|
||||
// printTree(p, i.second.tree,-1);
|
||||
// TreePrinter p;
|
||||
// std::cout << std::string(20, '=') << " thread "<< i.first << " "<< std::string(20, '=') << std::endl;
|
||||
// printTree(p, i.second.tree,-1);
|
||||
//}
|
||||
|
||||
if (!dump_filename.empty())
|
||||
|
@ -1,22 +1,22 @@
|
||||
project(profiler_sample)
|
||||
|
||||
set(CPP_FILES
|
||||
main.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
${CPP_FILES}
|
||||
${CPP_FILES}
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
|
||||
set(DISABLED_PROFILER_NAME
|
||||
"${PROJECT_NAME}_disabled_profiler"
|
||||
"${PROJECT_NAME}_disabled_profiler"
|
||||
)
|
||||
add_executable(${DISABLED_PROFILER_NAME} ${SOURCES})
|
||||
|
||||
if(UNIX)
|
||||
set(SPEC_LIB pthread)
|
||||
set(SPEC_LIB pthread)
|
||||
endif(UNIX)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} easy_profiler ${SPEC_LIB})
|
||||
|
186
sample/main.cpp
186
sample/main.cpp
@ -26,9 +26,9 @@ void localSleep(int magic=200000)
|
||||
}
|
||||
|
||||
void loadingResources(){
|
||||
EASY_FUNCTION(profiler::colors::Darkcyan);
|
||||
EASY_FUNCTION(profiler::colors::Darkcyan);
|
||||
localSleep();
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
|
||||
void prepareMath(){
|
||||
@ -37,7 +37,7 @@ void prepareMath(){
|
||||
for (int i = 0; i < OBJECTS; ++i)
|
||||
intarray[i] = i * i;
|
||||
delete[] intarray;
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||
}
|
||||
|
||||
void calcIntersect(){
|
||||
@ -51,7 +51,7 @@ void calcIntersect(){
|
||||
intarray[j] = i * j - i / 2 + (OBJECTS - j) * 5;
|
||||
}
|
||||
delete[] intarray;
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(4));
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(4));
|
||||
}
|
||||
|
||||
double multModel(double i)
|
||||
@ -81,7 +81,7 @@ void calcBrain(){
|
||||
for (int i = 0; i < OBJECTS; ++i)
|
||||
intarray[i] = calcSubbrain(i) + double(i * 180 / 3);
|
||||
delete[] intarray;
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||
}
|
||||
|
||||
void calculateBehavior(){
|
||||
@ -92,14 +92,14 @@ void calculateBehavior(){
|
||||
|
||||
void modellingStep(){
|
||||
EASY_FUNCTION(profiler::colors::Navy);
|
||||
prepareMath();
|
||||
calculateBehavior();
|
||||
prepareMath();
|
||||
calculateBehavior();
|
||||
}
|
||||
|
||||
void prepareRender(){
|
||||
EASY_FUNCTION(profiler::colors::Darkred);
|
||||
localSleep();
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
||||
|
||||
}
|
||||
|
||||
@ -121,168 +121,168 @@ void calculatePhysics(){
|
||||
for (int i = 0; i < OBJECTS; ++i)
|
||||
intarray[i] = calcPhysicForObject(i);
|
||||
delete[] intarray;
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
||||
}
|
||||
|
||||
void frame(){
|
||||
EASY_FUNCTION(profiler::colors::Magenta);
|
||||
prepareRender();
|
||||
calculatePhysics();
|
||||
prepareRender();
|
||||
calculatePhysics();
|
||||
}
|
||||
|
||||
void loadingResourcesThread(){
|
||||
//std::unique_lock<std::mutex> lk(cv_m);
|
||||
//cv.wait(lk, []{return g_i == 1; });
|
||||
//std::unique_lock<std::mutex> lk(cv_m);
|
||||
//cv.wait(lk, []{return g_i == 1; });
|
||||
EASY_THREAD("Resource loading");
|
||||
for(int i = 0; i < RESOURCE_LOADING_COUNT; i++){
|
||||
loadingResources();
|
||||
EASY_EVENT("Resources Loading!", profiler::colors::Cyan);
|
||||
for(int i = 0; i < RESOURCE_LOADING_COUNT; i++){
|
||||
loadingResources();
|
||||
EASY_EVENT("Resources Loading!", profiler::colors::Cyan);
|
||||
localSleep(1200000);
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void modellingThread(){
|
||||
//std::unique_lock<std::mutex> lk(cv_m);
|
||||
//cv.wait(lk, []{return g_i == 1; });
|
||||
//std::unique_lock<std::mutex> lk(cv_m);
|
||||
//cv.wait(lk, []{return g_i == 1; });
|
||||
EASY_THREAD("Modelling");
|
||||
for (int i = 0; i < RENDER_SPEPS; i++){
|
||||
modellingStep();
|
||||
for (int i = 0; i < RENDER_SPEPS; i++){
|
||||
modellingStep();
|
||||
localSleep(1200000);
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void renderThread(){
|
||||
//std::unique_lock<std::mutex> lk(cv_m);
|
||||
//cv.wait(lk, []{return g_i == 1; });
|
||||
//std::unique_lock<std::mutex> lk(cv_m);
|
||||
//cv.wait(lk, []{return g_i == 1; });
|
||||
EASY_THREAD("Render");
|
||||
for (int i = 0; i < MODELLING_STEPS; i++){
|
||||
frame();
|
||||
for (int i = 0; i < MODELLING_STEPS; i++){
|
||||
frame();
|
||||
localSleep(1200000);
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void four()
|
||||
{
|
||||
EASY_FUNCTION(profiler::colors::Red);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(37));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(37));
|
||||
}
|
||||
|
||||
void five()
|
||||
{
|
||||
EASY_FUNCTION(profiler::colors::Red);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
void six()
|
||||
{
|
||||
EASY_FUNCTION(profiler::colors::Red);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(42));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(42));
|
||||
}
|
||||
|
||||
void three()
|
||||
{
|
||||
EASY_FUNCTION(profiler::colors::Red);
|
||||
four();
|
||||
five();
|
||||
six();
|
||||
four();
|
||||
five();
|
||||
six();
|
||||
}
|
||||
|
||||
void seven()
|
||||
{
|
||||
EASY_FUNCTION(profiler::colors::Red);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(147));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(147));
|
||||
}
|
||||
|
||||
void two()
|
||||
{
|
||||
EASY_FUNCTION(profiler::colors::Red);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(26));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(26));
|
||||
}
|
||||
|
||||
void one()
|
||||
{
|
||||
EASY_FUNCTION(profiler::colors::Red);
|
||||
two();
|
||||
three();
|
||||
seven();
|
||||
two();
|
||||
three();
|
||||
seven();
|
||||
}
|
||||
|
||||
/*
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
six
|
||||
seven
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
six
|
||||
seven
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc > 1 && argv[1]){
|
||||
OBJECTS = std::atoi(argv[1]);
|
||||
}
|
||||
if (argc > 2 && argv[2]){
|
||||
RENDER_SPEPS = std::atoi(argv[2]);
|
||||
}
|
||||
if (argc > 3 && argv[3]){
|
||||
MODELLING_STEPS = std::atoi(argv[3]);
|
||||
}
|
||||
if (argc > 4 && argv[4]){
|
||||
RESOURCE_LOADING_COUNT = std::atoi(argv[4]);
|
||||
}
|
||||
if (argc > 1 && argv[1]){
|
||||
OBJECTS = std::atoi(argv[1]);
|
||||
}
|
||||
if (argc > 2 && argv[2]){
|
||||
RENDER_SPEPS = std::atoi(argv[2]);
|
||||
}
|
||||
if (argc > 3 && argv[3]){
|
||||
MODELLING_STEPS = std::atoi(argv[3]);
|
||||
}
|
||||
if (argc > 4 && argv[4]){
|
||||
RESOURCE_LOADING_COUNT = std::atoi(argv[4]);
|
||||
}
|
||||
|
||||
std::cout << "Objects count: " << OBJECTS << std::endl;
|
||||
std::cout << "Render steps: " << RENDER_SPEPS << std::endl;
|
||||
std::cout << "Modelling steps: " << MODELLING_STEPS << std::endl;
|
||||
std::cout << "Resource loading count: " << RESOURCE_LOADING_COUNT << std::endl;
|
||||
std::cout << "Objects count: " << OBJECTS << std::endl;
|
||||
std::cout << "Render steps: " << RENDER_SPEPS << std::endl;
|
||||
std::cout << "Modelling steps: " << MODELLING_STEPS << std::endl;
|
||||
std::cout << "Resource loading count: " << RESOURCE_LOADING_COUNT << std::endl;
|
||||
|
||||
auto start = std::chrono::system_clock::now();
|
||||
EASY_PROFILER_ENABLE;
|
||||
EASY_MAIN_THREAD;
|
||||
//one();
|
||||
//one();
|
||||
/**/
|
||||
std::vector<std::thread> threads;
|
||||
auto start = std::chrono::system_clock::now();
|
||||
EASY_PROFILER_ENABLE;
|
||||
EASY_MAIN_THREAD;
|
||||
//one();
|
||||
//one();
|
||||
/**/
|
||||
std::vector<std::thread> threads;
|
||||
|
||||
std::thread render = std::thread(renderThread);
|
||||
std::thread modelling = std::thread(modellingThread);
|
||||
std::thread render = std::thread(renderThread);
|
||||
std::thread modelling = std::thread(modellingThread);
|
||||
|
||||
|
||||
for(int i=0; i < 3; i++){
|
||||
threads.emplace_back(std::thread(loadingResourcesThread));
|
||||
threads.emplace_back(std::thread(renderThread));
|
||||
threads.emplace_back(std::thread(modellingThread));
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(cv_m);
|
||||
g_i = 1;
|
||||
}
|
||||
cv.notify_all();
|
||||
|
||||
for(int i=0; i < 3; i++){
|
||||
threads.emplace_back(std::thread(loadingResourcesThread));
|
||||
threads.emplace_back(std::thread(renderThread));
|
||||
threads.emplace_back(std::thread(modellingThread));
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(cv_m);
|
||||
g_i = 1;
|
||||
}
|
||||
cv.notify_all();
|
||||
|
||||
for (int i = 0; i < RENDER_SPEPS; ++i) {
|
||||
modellingStep();
|
||||
localSleep(1200000);
|
||||
}
|
||||
|
||||
render.join();
|
||||
modelling.join();
|
||||
for(auto& t : threads){
|
||||
t.join();
|
||||
}
|
||||
/**/
|
||||
render.join();
|
||||
modelling.join();
|
||||
for(auto& t : threads){
|
||||
t.join();
|
||||
}
|
||||
/**/
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
auto elapsed =
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
||||
auto end = std::chrono::system_clock::now();
|
||||
auto elapsed =
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
||||
|
||||
std::cout << "Elapsed time: " << elapsed.count() << " usec" << std::endl;
|
||||
std::cout << "Elapsed time: " << elapsed.count() << " usec" << std::endl;
|
||||
|
||||
auto blocks_count = profiler::dumpBlocksToFile("test.prof");
|
||||
auto blocks_count = profiler::dumpBlocksToFile("test.prof");
|
||||
|
||||
std::cout << "Blocks count: " << blocks_count << std::endl;
|
||||
std::cout << "Blocks count: " << blocks_count << std::endl;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
project(easy_profiler)
|
||||
|
||||
set(CPP_FILES
|
||||
block.cpp
|
||||
profile_manager.cpp
|
||||
reader.cpp
|
||||
block.cpp
|
||||
profile_manager.cpp
|
||||
reader.cpp
|
||||
event_trace_win.cpp
|
||||
)
|
||||
|
||||
set(H_FILES
|
||||
${ROOT}/include/profiler/profiler.h
|
||||
${ROOT}/include/profiler/reader.h
|
||||
${ROOT}/include/profiler/profiler.h
|
||||
${ROOT}/include/profiler/reader.h
|
||||
${ROOT}/include/profiler/event_trace_status.h
|
||||
profile_manager.h
|
||||
spin_lock.h
|
||||
profile_manager.h
|
||||
spin_lock.h
|
||||
event_trace_win.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
${CPP_FILES}
|
||||
${H_FILES}
|
||||
${CPP_FILES}
|
||||
${H_FILES}
|
||||
)
|
||||
add_definitions(
|
||||
-D_BUILD_PROFILER
|
||||
-D_BUILD_PROFILER
|
||||
)
|
||||
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user