0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-09-23 08:29:07 +03:00

Easyprofiler added

This commit is contained in:
Arin Alexander
2018-02-28 23:19:04 +03:00
parent edb89544f8
commit 6ad35d63be
218 changed files with 36639 additions and 17 deletions

View File

@@ -0,0 +1,16 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.5
# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/alex/Work/C++Projects/easyprofiler")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/alex/Work/C++Projects/easyprofiler")
# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})

View File

@@ -0,0 +1,31 @@
# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
"CXX"
)
# The set of files for implicit dependencies of each language:
set(CMAKE_DEPENDS_CHECK_CXX
"/home/alex/Work/C++Projects/easyprofiler/reader/main.cpp" "/home/alex/Work/C++Projects/easyprofiler/reader/CMakeFiles/profiler_reader.dir/main.cpp.o"
)
set(CMAKE_CXX_COMPILER_ID "GNU")
# Preprocessor definitions for this target.
set(CMAKE_TARGET_DEFINITIONS_CXX
"BUILD_WITH_EASY_PROFILER=1"
"EASY_DEFAULT_PORT=28077"
"EASY_PROFILER_VERSION_MAJOR=1"
"EASY_PROFILER_VERSION_MINOR=3"
"EASY_PROFILER_VERSION_PATCH=0"
)
# The include file search paths:
set(CMAKE_CXX_TARGET_INCLUDE_PATH
"easy_profiler_core/include"
)
# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
"/home/alex/Work/C++Projects/easyprofiler/easy_profiler_core/CMakeFiles/easy_profiler.dir/DependInfo.cmake"
)
# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")

View File

@@ -0,0 +1,114 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.5
# Delete rule output on recipe failure.
.DELETE_ON_ERROR:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/alex/Work/C++Projects/easyprofiler
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/alex/Work/C++Projects/easyprofiler
# Include any dependencies generated for this target.
include reader/CMakeFiles/profiler_reader.dir/depend.make
# Include the progress variables for this target.
include reader/CMakeFiles/profiler_reader.dir/progress.make
# Include the compile flags for this target's objects.
include reader/CMakeFiles/profiler_reader.dir/flags.make
reader/CMakeFiles/profiler_reader.dir/main.cpp.o: reader/CMakeFiles/profiler_reader.dir/flags.make
reader/CMakeFiles/profiler_reader.dir/main.cpp.o: reader/main.cpp
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/alex/Work/C++Projects/easyprofiler/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object reader/CMakeFiles/profiler_reader.dir/main.cpp.o"
cd /home/alex/Work/C++Projects/easyprofiler/reader && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/profiler_reader.dir/main.cpp.o -c /home/alex/Work/C++Projects/easyprofiler/reader/main.cpp
reader/CMakeFiles/profiler_reader.dir/main.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/profiler_reader.dir/main.cpp.i"
cd /home/alex/Work/C++Projects/easyprofiler/reader && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/alex/Work/C++Projects/easyprofiler/reader/main.cpp > CMakeFiles/profiler_reader.dir/main.cpp.i
reader/CMakeFiles/profiler_reader.dir/main.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/profiler_reader.dir/main.cpp.s"
cd /home/alex/Work/C++Projects/easyprofiler/reader && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/alex/Work/C++Projects/easyprofiler/reader/main.cpp -o CMakeFiles/profiler_reader.dir/main.cpp.s
reader/CMakeFiles/profiler_reader.dir/main.cpp.o.requires:
.PHONY : reader/CMakeFiles/profiler_reader.dir/main.cpp.o.requires
reader/CMakeFiles/profiler_reader.dir/main.cpp.o.provides: reader/CMakeFiles/profiler_reader.dir/main.cpp.o.requires
$(MAKE) -f reader/CMakeFiles/profiler_reader.dir/build.make reader/CMakeFiles/profiler_reader.dir/main.cpp.o.provides.build
.PHONY : reader/CMakeFiles/profiler_reader.dir/main.cpp.o.provides
reader/CMakeFiles/profiler_reader.dir/main.cpp.o.provides.build: reader/CMakeFiles/profiler_reader.dir/main.cpp.o
# Object files for target profiler_reader
profiler_reader_OBJECTS = \
"CMakeFiles/profiler_reader.dir/main.cpp.o"
# External object files for target profiler_reader
profiler_reader_EXTERNAL_OBJECTS =
bin/profiler_reader: reader/CMakeFiles/profiler_reader.dir/main.cpp.o
bin/profiler_reader: reader/CMakeFiles/profiler_reader.dir/build.make
bin/profiler_reader: bin/libeasy_profiler.so
bin/profiler_reader: reader/CMakeFiles/profiler_reader.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/alex/Work/C++Projects/easyprofiler/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable ../bin/profiler_reader"
cd /home/alex/Work/C++Projects/easyprofiler/reader && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/profiler_reader.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
reader/CMakeFiles/profiler_reader.dir/build: bin/profiler_reader
.PHONY : reader/CMakeFiles/profiler_reader.dir/build
reader/CMakeFiles/profiler_reader.dir/requires: reader/CMakeFiles/profiler_reader.dir/main.cpp.o.requires
.PHONY : reader/CMakeFiles/profiler_reader.dir/requires
reader/CMakeFiles/profiler_reader.dir/clean:
cd /home/alex/Work/C++Projects/easyprofiler/reader && $(CMAKE_COMMAND) -P CMakeFiles/profiler_reader.dir/cmake_clean.cmake
.PHONY : reader/CMakeFiles/profiler_reader.dir/clean
reader/CMakeFiles/profiler_reader.dir/depend:
cd /home/alex/Work/C++Projects/easyprofiler && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/alex/Work/C++Projects/easyprofiler /home/alex/Work/C++Projects/easyprofiler/reader /home/alex/Work/C++Projects/easyprofiler /home/alex/Work/C++Projects/easyprofiler/reader /home/alex/Work/C++Projects/easyprofiler/reader/CMakeFiles/profiler_reader.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : reader/CMakeFiles/profiler_reader.dir/depend

View File

@@ -0,0 +1,10 @@
file(REMOVE_RECURSE
"CMakeFiles/profiler_reader.dir/main.cpp.o"
"../bin/profiler_reader.pdb"
"../bin/profiler_reader"
)
# Per-language clean rules from dependency scanning.
foreach(lang CXX)
include(CMakeFiles/profiler_reader.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()

View File

@@ -0,0 +1,2 @@
# Empty dependencies file for profiler_reader.
# This may be replaced when dependencies are built.

View File

@@ -0,0 +1,10 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.5
# compile CXX with /usr/bin/c++
CXX_FLAGS = -O3 -DNDEBUG -DEASY_CHRONO_STEADY_CLOCK=0 -DEASY_CHRONO_HIGHRES_CLOCK=0 -DEASY_OPTION_START_LISTEN_ON_STARTUP=0 -DEASY_OPTION_MEASURE_STORAGE_EXPAND=0 -DEASY_OPTION_STORAGE_EXPAND_BLOCKS_ON=0 -DEASY_OPTION_IMPLICIT_THREAD_REGISTRATION=1 -DEASY_OPTION_REMOVE_EMPTY_UNGUARDED_THREADS=0 -DEASY_OPTION_LOG_ENABLED=0 -DEASY_OPTION_PRETTY_PRINT_FUNCTIONS=0 -DEASY_OPTION_BUILTIN_COLORS=1 -std=gnu++11
CXX_DEFINES = -DBUILD_WITH_EASY_PROFILER=1 -DEASY_DEFAULT_PORT=28077 -DEASY_PROFILER_VERSION_MAJOR=1 -DEASY_PROFILER_VERSION_MINOR=3 -DEASY_PROFILER_VERSION_PATCH=0
CXX_INCLUDES = -I/home/alex/Work/C++Projects/easyprofiler/easy_profiler_core/include

View File

@@ -0,0 +1 @@
/usr/bin/c++ -O3 -DNDEBUG CMakeFiles/profiler_reader.dir/main.cpp.o -o ../bin/profiler_reader -rdynamic ../bin/libeasy_profiler.so -lpthread -Wl,-rpath,/home/alex/Work/C++Projects/easyprofiler/bin

View File

@@ -0,0 +1,3 @@
CMAKE_PROGRESS_1 = 30
CMAKE_PROGRESS_2 = 31

View File

@@ -0,0 +1 @@
10

View File

@@ -0,0 +1,3 @@
add_executable(profiler_reader main.cpp)
target_link_libraries(profiler_reader easy_profiler)

View File

@@ -0,0 +1,34 @@
# Install script for directory: /home/alex/Work/C++Projects/easyprofiler/reader
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "Release")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()

146
3rdparty/easyprofiler/reader/main.cpp vendored Normal file
View File

@@ -0,0 +1,146 @@
#include <easy/profiler.h>
#include <easy/reader.h>
#include <fstream>
#include <list>
#include <iostream>
#include <map>
#include <stack>
#include <vector>
#include <iterator>
#include <algorithm>
#include <ctime>
#include <chrono>
#include <iostream>
#include <string>
#include <sstream>
class TreePrinter
{
struct Info{
std::string name;
std::string info;
};
std::vector<Info> m_rows;
public:
TreePrinter(){
}
void addNewRow(int level)
{
}
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;
//}
//
//for (const auto& i : tree.children){
// printTree(printer, i, level + 1, tree.node ? tree.node->block()->duration() : 0, root_dur);
//}
}
int main(int argc, char* argv[])
{
::profiler::thread_blocks_tree_t threaded_trees;
::std::string filename;// = "test.prof";
if (argc > 1 && argv[1])
{
filename = argv[1];
}
else
{
std::cout << "Specify prof file: ";
std::getline(std::cin, filename);
//return 255;
}
::std::string dump_filename;
if (argc > 2 && argv[2])
{
dump_filename = argv[2];
}
else
{
std::cout << "Specify output prof file: ";
std::getline(std::cin, dump_filename);
}
if (dump_filename.size() > 2)
{
EASY_PROFILER_ENABLE;
std::cout << "Will dump reader prof file to " << dump_filename << std::endl;
}
else
{
dump_filename.clear();
}
auto start = std::chrono::system_clock::now();
::profiler::SerializedData serialized_blocks, serialized_descriptors;
::profiler::descriptors_list_t descriptors;
::profiler::blocks_t blocks;
::std::stringstream errorMessage;
uint32_t descriptorsNumberInFile = 0;
uint32_t version = 0;
auto blocks_counter = fillTreesFromFile(filename.c_str(), serialized_blocks, serialized_descriptors, descriptors, blocks,
threaded_trees, descriptorsNumberInFile, version, true, errorMessage);
if (blocks_counter == 0)
std::cout << "Can not read blocks from file " << filename.c_str() << "\nReason: " << errorMessage.str();
auto end = std::chrono::system_clock::now();
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);
//}
if (!dump_filename.empty())
{
auto bcount = profiler::dumpBlocksToFile(dump_filename.c_str());
std::cout << "Blocks count for reader: " << bcount << std::endl;
}
//char c;
//::std::cin >> c;
return 0;
}