Jump to content


Popular Content

Showing content with the highest reputation on 03/27/21 in all areas

  1. David Heffernan

    QueryPerformanceCounter precision

    TStopwatch is implemented on Windows using QueryPerformanceCounter......
  2. balabuev

    Delphi WAT of the day

    Task completed:
  3. https://delphisorcery.blogspot.com/2021/03/how-to-hide-codeinsight-status-panel.html
  4. Attila Kovacs

    Delphi 10.4 Portable

    where exactly is the control right mouse button on a cell phone?
  5. Pascal bindings for PrimeSieve library - https://github.com/JulStrat/primesieve-pas. Examples provided. Tested with Rio 10.3 CE. it's my first code for Delphi. Suggestions and critics are welcome ...
  6. Uwe Raabe

    Reverse method walker

    This is a part of the Called By graph for the TCodeItem.Clear method in MMX Code Explorer as created by Understand. The dots allow to dynamically expand/collapse the next level. This goes up even to wired event handlers, f.i. to quickly find the form and control triggering the call.
  7. Kas Ob.

    QueryPerformanceCounter precision

    Yes i have, but first we must understand that Windows is not real time OS, means there is no guarantee of any timing periods to match your expectation, there might and will be some variation, and this will happen even with the existence of hardware functionality, in other words the timing will be emulated at best effort form the OS, on other hand there is CPU and hardware interrupts that can be very accurate, the problem is exposing these interrupts to be used by any application will compromise the integrity and stability of the OS, hence the OS isolate these low level hardware interrupts from software usage and keep them for itself to maintain the multithreading functionality, on side note here, i know that Z80 is somehow is beloved here so as fun fact, Z80 does have 3.58Mhz clock also does have only one timed interrupt that is guaranteed to call one fixed address 50 times per second, and this interrupt is accessible by any software to hook and this was the only way for games to simulate a multitasking (control, draw, update, output some buffers as music ..), also as fun fact its not 50 times per second but might also be 60 and this depends on your display ! Now back to Sleep(1), there is no of any sort from Windows to sleep specific amount, so yes it is a fact that Sleep(1) can range from less than 1/4 ms to 4 times the timing period ( which is by default is 15.66666 ms), why 4 ? it is just a number i saw, also will be highly affected by the system load. Also if you want to measure time then measure it the right way, it is fine to compare result between calls to QueryPerformanceCounter, but this miss the fact that QueryPerformanceCounter does not have a unit !, and to convert these numbers returned from it you should use QueryPerformanceFrequency with it, like this procedure TestQPerf; const cLoop = 100; var i, vStart, vStop, vMin, vMax, Freq: Int64; vIntArr: TArray<integer>; begin SetLength(vIntArr, cLoop); QueryPerformanceFrequency(Freq); for i := 0 to cLoop - 1 do begin QueryPerformanceCounter(vStart); Sleep(1); QueryPerformanceCounter(vStop); vIntArr[i] := vStop - vStart; end; for i := Low(vIntArr) to High(vIntArr) do Writeln((1000 * vIntArr[i] / Freq).ToString); vMin := System.Math.MinIntValue(vIntArr); vMax := System.Math.MaxIntValue(vIntArr); Writeln('Min: ' + vMin.ToString); Writeln('Max: ' + vMax.ToString); Writeln('Diff: ' + (vMax - vMin).ToString); Writeln('Min: ' + (1000 * vMin / Freq).ToString); Writeln('Max: ' + (1000 * vMax / Freq).ToString); Writeln('Diff: ' + (1000 * (vMax - vMin) / Freq).ToString); end; Now that will return Do you thing this result make sense now ? Now lets try and close IDE and browsers, Chrome does nasty stuff and measuring with chrome running in the background will give you different result on each system last thing to get better idea what is the expected time, then you need more fact about these timing result, so use deviation and/or variance, and you will get better picture on the timing interval on Windows.
  8. Stefan Glienke


    I am really trying hard to like that stuff but you are not making it easy - why always provide precompiled dlls and not the projects and instructions to do so myself? That would also make it easier to look into issues - there for example seems to be some issue with your libraries, I added D64TBB and D64IPP to my tests project and I get everything from all tests green, over some tests spuriously failing with changing errors to the process just silently dying at some point. (Spring4D, latest develop, in case you want to look into that yourself) - when the tests succeed btw they take approx 10-20% longer than with default MM/RTL.
  9. Rollo62

    Delphi 10.4 Portable

    My version, is portable. I have installed it on a notebook