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
  • 相关阅读:
    vue 环境的搭建及初始化项目
    vue axios 发送post请求,后端接收参数为null
    iOS-WKWebView的使用
    iOS开发GCD(3)-数据安全
    iOS开发-本地存储(偏好设置,Plist,归档)
    ios开发GCD(2)-dispatch_semaphore_t信号量计数器
    ios开发多线程之NSThread
    Runtime消息动态解析与转发流程
    iOS动画-从UIView到Core Animation
    贝塞尔曲线UIBezierPath简单使用
  • 原文地址:https://www.cnblogs.com/ljl_falcon/p/2840346.html
Copyright © 2011-2022 走看看