2 Replies Latest reply on Oct 22, 2007 7:09 PM by tobix

    Windows: Profiling System calls

    tobix
      Hello,
      I am profiling a small test program, which does 4 things:

      - create a piece of memory (which is normally delivered by a camera)
      - rotate that memory by 90°
      - create a windows DIB (using the Windows API CreateDIBitmap)
      - display that bitmap.

      If I measure the times using QueryPerformanceCounter most of the time is consumed by "CreateDIBitmap".

      CodeAnalyst always claims that the rotation is the most expensive part.

      How can can I measure the real time consuming parts using Code Analyst.
      I have tried TBP, EBP (with CSS), but the "CreateDIBitmap" call does not really take time.

      So what I am doing wrong that I get these huge differences between the two measurements?

      Thanks
      Tobias
        • Windows: Profiling System calls
          leiy
          Both measurements are correct. The data is interpreted in different perspectives.

          The CreateDIBitmap API in gdi32.dll may call other children functions internally. Using QueryPerformanceCounter() only measure the total time of CreateDIBitmap() itself and time of its children functions. The drawback is that it cannot if the time is spent in CreateDIBitmap() itself or children functions.

          CodeAnalyst is using sampling mechanism. The sample aggregation tells self time for each function. It pinpoint to where the real hotspot is.

          Assume:
          RotateMemory: self time 90, no children time;
          CreateDIBitmap spends self time 5 and it calls funX (selftime 40), funcY(selftime 30), funZ(selftime 50).

          CodeAnalyst will report
          RotateMemory: 90
          funZ: 50
          funX: 40
          FunY: 30
          CreateDIBitmap: 5

          QueryPerformanceCounter() will report:
          CreateDIBitmap(): 120
          RetateMemory: 90

          In my opinion, CodeAnalyst data is more meaningful.

          -Lei
            • Windows: Profiling System calls
              tobix
              Leiy,
              thanks for your fast reply!

              In my opinion, CodeAnalyst data is more meaningful.


              I do not share your opinion.

              If your are trying to improve single hot spots, CodeAnalyst's data is helpful.

              But if you are trying to identify where the real problems are, CodeAnalyst does not help.

              In my case I tried first to improve my rotation code, which did not help much.
              Later I discovered with simple time measurements, that it would be better to search for a better bitmap generation code.

              But thanks anyhow.
              Now I know how to handle Code Analyst's data.

              Tobias