Debugging, Profiling, Code improvement tools
  • Introduction
  • Chapter1: 追蹤問題
    • 1.1.找出錯誤來源
  • Chapter2: 解決問題
    • 2.1.Check list
      • 2.1.1.確認前後條件
  • Chapter3: 錯誤訊息
    • 3.1.python
      • 'charmap' codec can't decode byte 0x8f in position 17: character maps to <undefined>
  • Chapter4:版本管理工具
    • 4.1.Git
      • 4.1.1.Working tree, Index/Cache, Repository and Object
      • 4.1.2.commit
      • 4.1.3.cherry-pick
      • 4.1.4.rebase
    • 4.2.TortoiseGit
      • 4.2.1.bisect
      • 4.4.2.reflog & reset
      • 4.2.3.blame
  • Chapter5: 除錯工具
    • 5.1.Visual studio
      • 5.1.1.輸出debug訊息
      • 5.1.2.中斷點
      • 5.1.3.載入符號, 檢視堆疊
      • 5.1.4.追蹤點
      • 5.1.5.單步執行程式
      • 5.1.6.日誌
      • 5.1.7.靜態程式分析
    • 5.2. WinDbg
      • 5.2.1.安裝WinDbg
      • 5.2.2.設定project及symbol path
      • 5.2.3.分析.dmp file
    • 5.3.API
      • 5.3.1.核心傾印
  • Chapter6: 效能分析工具
    • 6.1.Introduction
    • 6.2.Windows
      • 6.2.1.效能分析指標
      • 6.2.2.Windows Performance Monitor
      • 6.2.3.Process monitor
      • 6.2.4.Windows Performance Toolkit
    • 6.3.C++ project
      • 6.3.1.SMART BEAR AQ Time
    • 6.4.Python project
      • 6.4.1.cProfile, snakeviz
  • Chapter7: 程式碼優化工具
    • 7.1.Python
      • 7.1.1.vulture
Powered by GitBook
On this page
  • 1.Introduction
  • 2.Profiling
  • 3.Filtering less relevant functions
  • 4.Optimize performance

Was this helpful?

  1. Chapter6: 效能分析工具
  2. 6.3.C++ project

6.3.1.SMART BEAR AQ Time

Previous6.3.C++ projectNext6.4.Python project

Last updated 5 years ago

Was this helpful?

1.Introduction

  • AQtime is a performance profiler and memory/resource debugging toolset developed by SmartBear Software. It is integrated into Microsoft Visual Studio, Visual Studio Test Projects and Embarcadero RAD Studio[4] that allows analyzing the application without leaving the development environment (source: )

2.Profiling

  • 1.Install AQ Time Software

  • 2.Create a AQ Time Project

    • Right click on solution and select Add -> New Project

  • 3.Set profiling target output file

    • On Setup page of AQ Time Project, right click on left side bar and select Add Output

  • 4.Start profiling

    • Select AQtime->Run from menu bar, then the target output file you set before will be launched, do the action what you want to profile

  • 5.Get result

    • 1.Click Get results you can get a report from start to present

      • Time

      • Time with Children

      • Hot Count

    • 2.Click one function that you would like to know the detail, you can click Panel List -> Call Graph

    • 3.Finally, you can get some information such as: Code Type, Hit Count, Time, Time with Children for selected function and children function

3.Filtering less relevant functions

  • In order to find out the performance bottleneck, we can exclude some sections or functions if they are not part of your

4.Optimize performance

  • 1.Found the performance bottleneck from report and graph which AQ time generated

  • 2.For example, I find that DoNavigationLineOverlapCheck() was the performance bottleneck, check it's children by checking graph

  • 3.The constructor of LaneLineInfo will be called many time because we create new LaneLineInfo Objects in for loop

LanelineList NavigationSplineOverlapCheck::CheckAndGetFailedLines(
    const LanelineList& aLanelineList,
    int* aTotalCheck /*= nullptr*/)
{
    static const double aNavigationLineWidth = FileData::GetConfigReader()->GetNavigationLineWidth();

    LanelineList failedLineList;
    if (aTotalCheck != nullptr)
    {
        *aTotalCheck = 0;
    }
    bool checkFlag = false;
    int laneLineSize = aLanelineList.size();
    for(int i = 0 ; i < laneLineSize; i++)
    {
        checkFlag = false;
        LanelineInfo outerLane = aLanelineList[i];
        for(int j = i + 1 ; j < laneLineSize; j++)
        {
            LanelineInfo innerLane = aLanelineList[j];
            if( innerLane._fromLane._line2DId == outerLane._fromLane._line2DId &&
                innerLane._toLane._line2DId == outerLane._toLane._line2DId)
            {
                ...
  • 4.To optimize the performance of this function and also maintain readability, using const reference was a good choice in this case

LanelineList NavigationSplineOverlapCheck::CheckAndGetFailedLines(
    const LanelineList& aLanelineList,
    int* aTotalCheck /*= nullptr*/)
{
    static const double aNavigationLineWidth = FileData::GetConfigReader()->GetNavigationLineWidth();

    LanelineList failedLineList;
    if (aTotalCheck != nullptr)
    {
        *aTotalCheck = 0;
    }
    bool checkFlag = false;
    int laneLineSize = aLanelineList.size();
    for(int i = 0 ; i < laneLineSize; i++)
    {
        checkFlag = false;
        const LanelineInfo& outerLane = aLanelineList[i];
        for(int j = i + 1 ; j < laneLineSize; j++)
        {
            const LanelineInfo& innerLane = aLanelineList[j];
            if( innerLane._fromLane._line2DId == outerLane._fromLane._line2DId &&
                innerLane._toLane._line2DId == outerLane._toLane._line2DId)
            {
                ...
  • 5.Check the graph again after we modify the code, the change optimize the performance for sure according to the latest time cost of LaneLineInfo is smaller than before

wiki