diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 3cd61e5..1e22785 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,3 @@ -# These are supported funding model platforms - -github: yse +github: [yse, cas4ey] open_collective: easy_profiler -custom: paypal.me/ysergey +custom: ["https://paypal.me/ysergey"] diff --git a/.gitignore b/.gitignore index 4de9761..e1d3404 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,13 @@ bin /*.prof .idea/ bazel* + +# CMake/QtCreator folders and files created on Windows +CMakeFiles/ +*/CMakeFiles/ +CMakeCache*.* +Makefile* +moc_*.* +mocs_*.* +qrc_*.* +*.cmake diff --git a/.travis.yml b/.travis.yml index 2d12220..0b26f70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ -sudo: required -dist: trusty -language: cpp +dist: xenial cache: ccache -matrix: +language: cpp +jobs: include: - compiler: gcc os: linux @@ -14,47 +13,26 @@ matrix: - g++-5 - cmake - cmake-data + - qt5-default env: -CXX_COMPILER=g++-5 -C_COMPILER=gcc-5 - os: osx - osx_image: xcode10 - #compiler: clang + osx_image: xcode11.4 env: - #-CXX_COMPILER=clang++ - #-C_COMPILER=clang -CXX_COMPILER=g++-5 -C_COMPILER=gcc-5 + -HOMEBREW_NO_AUTO_UPDATE=1 script: - mkdir build - cd build - - cmake --version - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then - source /opt/qt55/bin/qt55-env.sh; - qmake -v; - else + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then export PATH=/usr/local/opt/qt/bin:$PATH; fi - cmake -DCMAKE_CXX_COMPILER=$CXX_COMPILER -DCMAKE_C_COMPILER=$C_COMPILER .. && make -j3 -after_success: - - cd ../sample && $CXX_COMPILER -std=c++11 -O3 main_clock.cpp -o test_clock && ./test_clock - - ./build_express_test.sh -before_install: - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then - sudo add-apt-repository --yes ppa:beineri/opt-qt551-trusty; - sudo apt-get update -qq; - else - brew update; - fi install: - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then - sudo apt-get -y install qt55tools qt55script qt55base qt55svg; - else + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install gcc5; brew install qt; brew link --force qt; fi - - - - diff --git a/LICENSE b/LICENSE index 5642517..1ab15b0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2019 Sergey Yagovtsev, Victor Zarubkin +Copyright (c) 2016-2021 Sergey Yagovtsev, Victor Zarubkin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 78bb9ed..3fde220 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # easy_profiler [![2.1.0](https://img.shields.io/badge/stable-2.1.0-009688.svg)](https://github.com/yse/easy_profiler/releases/tag/v2.1.0) [![2.x.x](https://img.shields.io/badge/latest-2.x.x-f57f17.svg)](https://github.com/yse/easy_profiler) -[![Build Status](https://travis-ci.org/yse/easy_profiler.svg?branch=develop)](https://travis-ci.org/yse/easy_profiler) +[![Build Status](https://travis-ci.com/yse/easy_profiler.svg?branch=develop)](https://travis-ci.com/yse/easy_profiler) [![Build Status](https://ci.appveyor.com/api/projects/status/github/yse/easy_profiler?branch=develop&svg=true)](https://ci.appveyor.com/project/yse/easy-profiler/branch/develop) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) @@ -321,7 +321,7 @@ struct EasyFileHeader { # License Licensed under either of -- MIT license ([LICENSE.MIT](LICENSE.MIT) or http://opensource.org/licenses/MIT) -- Apache License, Version 2.0, ([LICENSE.APACHE](LICENSE.APACHE) or http://www.apache.org/licenses/LICENSE-2.0) +- MIT license ([mit.lic](mit.lic) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0 ([apache.lic](apache.lic) or http://www.apache.org/licenses/LICENSE-2.0) at your option. diff --git a/LICENSE.APACHE b/apache.lic similarity index 100% rename from LICENSE.APACHE rename to apache.lic diff --git a/LICENSE.MIT b/mit.lic similarity index 100% rename from LICENSE.MIT rename to mit.lic diff --git a/profiler_gui/graphics_block_item.cpp b/profiler_gui/graphics_block_item.cpp index f8d322c..06f1e1f 100644 --- a/profiler_gui/graphics_block_item.cpp +++ b/profiler_gui/graphics_block_item.cpp @@ -1271,9 +1271,26 @@ const ::profiler_gui::EasyBlock* GraphicsBlockItem::intersect(const QPointF& _po while (i <= levelIndex) { const auto& level = m_levels[i]; + size_t levelSize = level.size(); + + auto firstItemIterator = level.begin(); + auto lastItemIterator = level.begin(); + + // Ensure that firstItem and lastItem are within the permissible range + if (firstItem < levelSize) { + std::advance(firstItemIterator, firstItem); + } else { + firstItemIterator = level.end(); + } + + if (lastItem <= levelSize) { + std::advance(lastItemIterator, lastItem); + } else { + lastItemIterator = level.end(); + } // Search for first visible item - auto first = ::std::lower_bound(level.begin() + firstItem, level.begin() + lastItem, _pos.x(), [](const ::profiler_gui::EasyBlockItem& _item, qreal _value) + auto first = ::std::lower_bound(firstItemIterator, lastItemIterator, _pos.x(), [](const ::profiler_gui::EasyBlockItem& _item, qreal _value) { return _item.left() < _value; }); diff --git a/profiler_gui/tree_widget_item.cpp b/profiler_gui/tree_widget_item.cpp index d78b980..27f539b 100644 --- a/profiler_gui/tree_widget_item.cpp +++ b/profiler_gui/tree_widget_item.cpp @@ -374,9 +374,9 @@ const profiler::BlocksTree& TreeWidgetItem::block() const profiler::thread_id_t TreeWidgetItem::threadId() const { const QTreeWidgetItem* parentItem = this; - while (parentItem->parent() != nullptr) + while (parentItem != nullptr && parentItem->parent() != nullptr) { - parentItem = parent(); + parentItem = parentItem->parent(); } return static_cast(parentItem->data(COL_NAME, Qt::UserRole).toULongLong()); }