Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"It's like deja vu all over again." -- Yogi Berra


interests / soc.culture.china / More of my philosophy about the essence of measuring time in the computer and about the final source code version of my StopWatch and about RDTSCP and RDTSC and about the CPU frequency scaling and about the memory barriers and about good technicality

SubjectAuthor
o More of my philosophy about the essence of measuring time in theAmine Moulay Ramdane

1
More of my philosophy about the essence of measuring time in the computer and about the final source code version of my StopWatch and about RDTSCP and RDTSC and about the CPU frequency scaling and about the memory barriers and about good technicality

<1756828c-79ef-40a4-b78a-7f7311d24117n@googlegroups.com>

  copy mid

https://novabbs.com/interests/article-flat.php?id=13589&group=soc.culture.china#13589

  copy link   Newsgroups: soc.culture.china
X-Received: by 2002:ad4:55e8:0:b0:635:f079:8dcd with SMTP id bu8-20020ad455e8000000b00635f0798dcdmr41598qvb.6.1689038348315;
Mon, 10 Jul 2023 18:19:08 -0700 (PDT)
X-Received: by 2002:aa7:8890:0:b0:674:1663:1270 with SMTP id
z16-20020aa78890000000b0067416631270mr18710671pfe.4.1689038347565; Mon, 10
Jul 2023 18:19:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: soc.culture.china
Date: Mon, 10 Jul 2023 18:19:07 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=66.131.174.130; posting-account=R-6XjwoAAACnHXTO3L-lyPW6wRsSmYW9
NNTP-Posting-Host: 66.131.174.130
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1756828c-79ef-40a4-b78a-7f7311d24117n@googlegroups.com>
Subject: More of my philosophy about the essence of measuring time in the
computer and about the final source code version of my StopWatch and about
RDTSCP and RDTSC and about the CPU frequency scaling and about the memory
barriers and about good technicality
From: amine...@gmail.com (Amine Moulay Ramdane)
Injection-Date: Tue, 11 Jul 2023 01:19:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 912
 by: Amine Moulay Ramdane - Tue, 11 Jul 2023 01:19 UTC

Hello,

More of my philosophy about the essence of measuring time in the computer and about the final source code version of my StopWatch and about RDTSCP and RDTSC and about the CPU frequency scaling and about the memory barriers and about good technicality and the deeper understanding of the StopWatch and and more about x86 and ARM processors and about solar cells and about AES 256 encryption and TSMC and about China and about the Transformers and about Toyota and about China and about objective truth and about the objective and about the paper about the multiple universes and about quantum world and about consciousness and about mathematics and about the universe and about mathematical probability and about the positive behavior and about the positive mindset and about patience and about the positive energy and about the "packaging" or "presentation" and about the ideal and about the being idealistic and more of my thoughts..

I am a white arab from Morocco, and i think i am smart since i have also
invented many scalable algorithms and algorithms..

So i think i am highly smart since I have passed two certified IQ tests and i have scored above 115 IQ, and i mean that it is "above" 115 IQ, so i will talk more about the essence of measuring time in the computer, so from my understanding with my fluid intelligence how to implement my new StopWatch, i am discovering patterns with my fluid intelligence that
explain more the essence of measuring time in the computer, so here they are: so you have to get the frequency of the CPU, i mean when you are measuring time , you are measuring the CPU frequency too, but in the new
CPUs, the frequency can dynamically change, so you have two ways of doing it , so you can disable CPU frequency scaling in the bios and do
your exact time's measurement, and you can set it again, but the second way is that you can get a decent approximation without disabling the
CPU frequency scaling and do the benchmark timing of your code , as i am explaining it below, and of course the new CPUs today are multicores, so you have to set the CPU affinity as i will explain to you how so that to do the timing with the StopWatch, other than that, you can get a good microsecond accuracy and a decent nanosecond accuracy with RDTSC assembler instruction, but you can get a CPU tick accuracy with RDTSCP assembler instruction, but so that know more about them , read my below thoughts, other than that, i am also explaining much more deeply the implementation of a StopWatch in my below thoughts, so i invite you to read my below thoughts so that to understand my views on how to implement a good StopWatch:

So i think i am highly smart since I have passed two certified IQ tests and i have scored above 115 IQ, and i mean that it is "above" 115 IQ, so i have
just updated my StopWatch to support both RDTSCP and RDTSC assembler
instructions, so when the CPU is not new and it doesn't support RDTSCP , it will use RDTSC, and when it is a new CPU that supports RDTSCP , it will use it, so RDTSC is not a serializing instruction, so i have just correctly used the necessary memory barriers, and RDTSCP is a serializing instruction.

So i will now document correctly my StopWatch so that you also know how to use correctly the CPU affinity, and now you can download my final version of my source code from my website here:

https://sites.google.com/site/scalable68/a-portable-timer-for-delphi-and-freepascal

And i invite you to read all my previous following thoughts so that to deeply understand the StopWatch:

So i think i am highly smart since I have passed two certified IQ tests and i have scored above 115 IQ, and i mean that it is "above" 115 IQ, so now i have to explain something important, so for a deep understanding of the StopWatch, you have to know more that the assembler instruction RDTSC is supported by the great majority of x86 and x64 CPUs, but it is not a serializing instruction , i mean that it can be subject to out-of-order execution that may affect its accuracy, so it is why i have just added correctly some other memory barriers, and now i think that it is working correctly, so you have to understand that there is another assembler instruction RDTSCP that is serializing instruction and is not subject to out-of-order execution, but it is compatible with just the new x86 and x64 CPUs, so i will support it in the very near future, but now i think you can be confident with my new updated StopWatch, and i think it is an interesting StopWatch that shows how to implement a good StopWatch from the low level layers. So i think you have to be smart so that to implement it correctly with the RDTSC, as i have just done it, so you can download the source code of my new StopWatch that i have just updated from my website here:

https://sites.google.com/site/scalable68/a-portable-timer-for-delphi-and-freepascal

And i invite you to read my previous below thoughts so that to have a deep understanding of the StopWatch:

So i think that my new StopWatch can give a decent approximation even of you don't disable CPU frequency scaling in the bios, and here is why:

When benchmarking a CPU under a heavy workload, it is generally expected that frequency scaling changes will be relatively small or negligible. This is because the frequency scaling mechanism typically aims to maximize performance during such scenarios.

Under heavy load, the CPU frequency scaling algorithm often increases the CPU frequency to provide higher processing power and performance. The goal is to fully utilize the CPU's capabilities for the benchmarking workload.

In these cases, frequency scaling changes are generally designed to be minimal to avoid introducing significant variations in performance. The CPU frequency may remain relatively stable or vary within a relatively small range during the benchmarking process.

Considering these factors, when benchmarking under heavy workload conditions, the impact of frequency scaling changes on timing measurements using RDTSC is typically limited. As a result, RDTSC can provide a reasonable approximation of timing for benchmarking purposes.

So then i invite you to read my following previous thoughts so that you understand my views on the StopWatch:

I have just updated my new StopWatch, and it now also includes the correct memory barriers for previous 32 bit Delphi versions like Delphi 7 ,
and you can download it from the just below web link, and i invite you to read my below previous thoughts so that to understand my views about the StopWatch:

So i have just updated my new StopWatch, so the first problem is:

- Instruction reordering: The rdtsc instruction itself is not a serializing instruction, which means that it does not necessarily prevent instruction reordering. In certain cases, the CPU may reorder instructions, leading to inaccuracies in timing measurements.

So i have just used memory barriers so that to solve the above problem.

And here is the second problem:

- CPU frequency scaling: Modern CPUs often have dynamic frequency scaling, where the CPU frequency can change based on factors such as power management and workload. This can result in variations in the time measurement based on the CPU's operating frequency.

So you have to disable CPU frequency scaling in the bios so that to solve the
above problem , and after that make your timing with my StopWatch.

And for the following third problem:

- Multicore/Threaded environments: If your system has multiple cores or threads, using rdtsc may not provide synchronized timing across different cores or threads. This can lead to inconsistent and unreliable timing measurements.

You can set the CPU affinity so that to solve the third problem.

So i will document more my StopWatch so that to learn you how to use it,
so stay tuned !

And now i have just updated my new StopWatch with the necessary memory barriers, and now you can be confident with my new updated StopWatch.

So now my new updated StopWatch uses memory barriers correctly, and it avoids the overflow problem of the Time Stamp Counter (TSC) , and it supports microseconds and nanoseconds and CPU clocks timing, and it is object oriented, and i have just made it support both x86 32 bit and x64 64 bit CPUs and it supports both Delphi and Freepascal compilers and it works in both Windows and Linux, so what is good about my new StopWatch is that it shows how you implement it from the low level layers in assembler etc., so i invite you to look at the new updated version of my source code that you can download from my website here:

https://sites.google.com/site/scalable68/a-portable-timer-for-delphi-and-freepascal

Other than that, read my below previous thoughts so that to understand my views:

So now we have to attain a "deep" understanding of the StopWatch,
so i think i am highly smart since I have passed two certified IQ tests and i have scored above 115 IQ, and i mean that it is "above" 115 IQ, so as you are noticing that i am, with my fluid intelligence, understanding deeply the StopWatch, so i have just discovered that the following StopWatch: https://www.davdata.nl/math/timer.html , from the following engineer from Amsterdam: https://www.davdata.nl/math/about.html , is not working correctly: since he is calling the function GetTickCount() in the constructor, but there is a problem and a bug, since when the tick count value in milliseconds returned by GetTickCount() reaches its maximum value that is high(dword) , it will wrap around to zero and start counting up again. This is because the tick count is typically stored in a fixed-size data type that has a maximum value, so it is why his way of timing in milliseconds in the constructor that he is using is not working, since it is not safe, so even if this StopWatch of this engineer from Amsterdam does effectively avoid the overflow problem of the Time Stamp Counter (TSC), since he is using an int64 in 32 bit x86 architecture in the Intel assembler function of getCPUticks() that i am understanding, and this int64 can, from my calculations, go up to 29318.9829 years , so i think his StopWatch is not working for the reason i am giving just above, and second problem is the accuracy of the timing obtained from the code he provided using rdtsc instruction in assembler is dependent on various factors, including the hardware and software environment. However, it's important to note that directly using rdtsc for timing purposes may not provide the desired accuracy due to several reasons:


Click here to read the complete article

interests / soc.culture.china / More of my philosophy about the essence of measuring time in the computer and about the final source code version of my StopWatch and about RDTSCP and RDTSC and about the CPU frequency scaling and about the memory barriers and about good technicality

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor