zoukankan      html  css  js  c++  java
  • Delphi 性能优化工具

    Many users asked Embarcadero to include a profiler in the next Delphi for Win32.

    Waiting for this, there are some interesting tools for profile a Delphi program.

    For example, AsmProfile is an Open Source sampling profiler wich is very simple to use.

    UPDATE:

    Actually AsmProfile is an “Instrumenting” profiler. It uses runtime function detouring and assembly to profile any selected function.

    If you dont know differences between Instrumenting profiler and Sampling profiler, you can go here or here and read about it.

    So, Suppose to have a slow code like this:

    Download AsmProfiler from SVN or project home page (see the end of the article).

    Now you can put 2 unit in your uses clause and initialize profiler interface directly in your dpr

    So far so good… compile your app with following settings:
    Delphi -> Project Options:

    • Linker -> Map file = detailed
    • Compiler -> Optimization = off
    • Compiler -> Stack frames = on

    In this way, the profiler can reach procedures address for profiling phase.
    Run your application and a small form will show up. In this form your must select the profiled methods and then click “Start”.

    Now stress your application, click “Stop” and then “Show Results”.
    In the “results” form will be shown detailed information about program execution.

    Every call timing is splitted in “Calls”, “Parent Calls” and “Child calls” and some stats has been calculated too.

    AsmProfiler It’s not complete like AQTime from AutomatedQA, but it’s a very usefull tool for every Delphi programmer.

    You can find AsmProfiler here but I suggest to download the updated SVN version.

    UPDATE:

    AsmProfile can also profile your code without change source using DllInjection.

    When you only have an executable:

      • Start your executable
      • Start “dllinject.exe” (will show up a console window)
      • Get the PID of your executable via Windows Task Manager or Sysinternal Process Exlorer
      • Enter this number in the console black
      • Start profiling
  • 相关阅读:
    实验三:UML 建模工具的安装与使用
    结对编程 第二阶段
    实验二:结对编程 第一阶段
    结对编程之github使用自己的仓库
    软工 实验一 Git代码版本管理
    第七次作业
    第5次作业
    第四次作业
    第三次作业
    第二次作业
  • 原文地址:https://www.cnblogs.com/ljl_falcon/p/2840346.html
Copyright © 2011-2022 走看看