Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #81573

Re: Some help needed

From Bonita Montero <Bonita.Montero@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Some help needed
Date 2021-09-25 19:14 +0200
Organization A noiseless patient Spider
Message-ID <sinldi$j1h$1@dont-email.me> (permalink)
References <since9$gua$1@dont-email.me> <ir937iFps6uU1@mid.individual.net>

Show all headers | View raw


Am 25.09.2021 um 19:05 schrieb Bo Persson:

>> This is the code:
>>
>> #include <iostream>
>> #include <chrono>
>> #include <cstddef>
>> #include <cstdint>
>> #include <immintrin.h>
>>
>> using namespace std;
>> using namespace chrono;
>>
>> int main( int argc, char **argv )
>> {
>>      static uint64_t const PAUSE_ROUNDS = 1'000'000'000;
>>      auto start = high_resolution_clock::now();
>>      for( uint64_t i = PAUSE_ROUNDS; i; --i )
>>          _mm_pause();
>>      double ns = (int64_t)duration_cast<nanoseconds>( 
>> high_resolution_clock::now() - start ).count() / (double)PAUSE_ROUNDS;
>>      cout << ns << endl;
>> }
> 
> I get
> 
> 30.7635
> 
> (Core i9 9900K  5GHz)

Why did AMD decide for such an idiotic timing ? That is neither suitable
for spin-loops with only a single PAUSE-instructions, nor does it save
power while spinning.

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Some help needed Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 16:41 +0200
  Re: Some help needed Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-25 19:51 +0300
    Re: Some help needed Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 19:01 +0200
    Re: Some help needed Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 17:20 +0000
  Re: Some help needed Bo Persson <bo@bo-persson.se> - 2021-09-25 19:05 +0200
    Re: Some help needed Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 19:14 +0200
    Re: Some help needed Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 17:33 +0000
  Re: Some help needed Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 17:15 +0000
    Re: Some help needed Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-25 19:16 +0200
      Re: Some help needed Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 17:29 +0000
  Re: Some help needed Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-26 07:26 +0200
    Re: Some help needed Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-26 06:56 +0000
    Re: Some help needed - further help Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-27 17:35 +0200
      Re: Some help needed - further help Bo Persson <bo@bo-persson.se> - 2021-09-27 19:29 +0200

csiph-web