<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Time Stamp Counter &amp;lt;- optimieren, dass es nicht so sehr ruckelt]]></title><description><![CDATA[<p>hi,</p>
<p>aus dem forum habe ich den code,<br />
den link weiss ich jetzt nicht mehr,</p>
<p>mein problem ist, dass das programm wenn ich es zb verschiebe ruckelt,<br />
bzw langsam arbeitet, veilleicht kann mir jemand helfen....</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;iostream&gt;
#include &lt;windows.h&gt;

using namespace std;

#include &quot;cpu_auslesen.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;

int igOldMouseX, igOldMouseY;
bool onoff=true;

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void GetMHZ()
{
  unsigned long v1, v2, v3, v4;
  long double MHz;

  _asm{
        rdtsc
        mov [v1], eax
        mov [v2], edx
      }

  ::Sleep(500);

    _asm{
        rdtsc
        mov [v3], eax
        mov [v4], edx
      }

  v1=v3-v1;
  v2=v4-v2;
  MHz=(v1+(v2*(2^32)))/1000/500;

 Form1-&gt;Label1-&gt;Caption=(int)MHz;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::bnt_EndeClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  GetMHZ();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Timer1-&gt;Interval = 1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift,
      int X, int Y)
{
  int iDeltaX, iDeltaY;
  if (Shift.Contains(ssLeft))
  {
    iDeltaX = X - igOldMouseX;
    iDeltaY = Y - igOldMouseY;
    Top = Top + iDeltaY;
    Left = Left + iDeltaX;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btn_PauseClick(TObject *Sender)
{
if(onoff == true)
 {
 onoff = false;
 Timer1-&gt;Enabled=false;
 btn_Pause-&gt;Caption=&quot;Weiter&quot;;
 }
else
 {
  onoff = true;
  Timer1-&gt;Enabled=true;
  btn_Pause-&gt;Caption=&quot;Pause&quot;;
 }

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
  if (Button == mbLeft)
  {
    igOldMouseX = X;
    igOldMouseY = Y;
  }
}
//---------------------------------------------------------------------------
</code></pre>
<p>so, sieht mein form aus !!!</p>
<pre><code class="language-cpp">object Form1: TForm1
  Left = 330
  Top = 119
  BorderStyle = bsNone
  ClientHeight = 76
  ClientWidth = 235
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  OnMouseDown = FormMouseDown
  OnMouseMove = FormMouseMove
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 144
    Top = 15
    Width = 18
    Height = 37
    Caption = '0'
    Color = clBtnFace
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -32
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentColor = False
    ParentFont = False
  end
  object bnt_Ende: TButton
    Left = 16
    Top = 7
    Width = 75
    Height = 25
    Caption = 'Ende'
    TabOrder = 0
    OnClick = bnt_EndeClick
  end
  object btn_Pause: TButton
    Left = 16
    Top = 39
    Width = 75
    Height = 25
    Caption = 'Pause'
    TabOrder = 1
    OnClick = btn_PauseClick
  end
  object Timer1: TTimer
    Interval = 250
    OnTimer = Timer1Timer
    Left = 152
    Top = 15
  end
end
</code></pre>
<p>ich will es so wie das beispiel hier -&gt; <a href="http://www.ricosonntag.de/download/examples/CPUSpeed.zip" rel="nofollow">http://www.ricosonntag.de/download/examples/CPUSpeed.zip</a><br />
ohne ruckeln beim verschieben haben...</p>
<p>mfg</p>
<p>HubertS</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/158109/time-stamp-counter-lt-optimieren-dass-es-nicht-so-sehr-ruckelt</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Apr 2026 04:28:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/158109.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 Sep 2006 13:39:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Time Stamp Counter &amp;lt;- optimieren, dass es nicht so sehr ruckelt on Fri, 01 Sep 2006 13:43:26 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>aus dem forum habe ich den code,<br />
den link weiss ich jetzt nicht mehr,</p>
<p>mein problem ist, dass das programm wenn ich es zb verschiebe ruckelt,<br />
bzw langsam arbeitet, veilleicht kann mir jemand helfen....</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;iostream&gt;
#include &lt;windows.h&gt;

using namespace std;

#include &quot;cpu_auslesen.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;

int igOldMouseX, igOldMouseY;
bool onoff=true;

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void GetMHZ()
{
  unsigned long v1, v2, v3, v4;
  long double MHz;

  _asm{
        rdtsc
        mov [v1], eax
        mov [v2], edx
      }

  ::Sleep(500);

    _asm{
        rdtsc
        mov [v3], eax
        mov [v4], edx
      }

  v1=v3-v1;
  v2=v4-v2;
  MHz=(v1+(v2*(2^32)))/1000/500;

 Form1-&gt;Label1-&gt;Caption=(int)MHz;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::bnt_EndeClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  GetMHZ();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Timer1-&gt;Interval = 1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift,
      int X, int Y)
{
  int iDeltaX, iDeltaY;
  if (Shift.Contains(ssLeft))
  {
    iDeltaX = X - igOldMouseX;
    iDeltaY = Y - igOldMouseY;
    Top = Top + iDeltaY;
    Left = Left + iDeltaX;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btn_PauseClick(TObject *Sender)
{
if(onoff == true)
 {
 onoff = false;
 Timer1-&gt;Enabled=false;
 btn_Pause-&gt;Caption=&quot;Weiter&quot;;
 }
else
 {
  onoff = true;
  Timer1-&gt;Enabled=true;
  btn_Pause-&gt;Caption=&quot;Pause&quot;;
 }

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
  if (Button == mbLeft)
  {
    igOldMouseX = X;
    igOldMouseY = Y;
  }
}
//---------------------------------------------------------------------------
</code></pre>
<p>so, sieht mein form aus !!!</p>
<pre><code class="language-cpp">object Form1: TForm1
  Left = 330
  Top = 119
  BorderStyle = bsNone
  ClientHeight = 76
  ClientWidth = 235
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  OnMouseDown = FormMouseDown
  OnMouseMove = FormMouseMove
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 144
    Top = 15
    Width = 18
    Height = 37
    Caption = '0'
    Color = clBtnFace
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -32
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentColor = False
    ParentFont = False
  end
  object bnt_Ende: TButton
    Left = 16
    Top = 7
    Width = 75
    Height = 25
    Caption = 'Ende'
    TabOrder = 0
    OnClick = bnt_EndeClick
  end
  object btn_Pause: TButton
    Left = 16
    Top = 39
    Width = 75
    Height = 25
    Caption = 'Pause'
    TabOrder = 1
    OnClick = btn_PauseClick
  end
  object Timer1: TTimer
    Interval = 250
    OnTimer = Timer1Timer
    Left = 152
    Top = 15
  end
end
</code></pre>
<p>ich will es so wie das beispiel hier -&gt; <a href="http://www.ricosonntag.de/download/examples/CPUSpeed.zip" rel="nofollow">http://www.ricosonntag.de/download/examples/CPUSpeed.zip</a><br />
ohne ruckeln beim verschieben haben...</p>
<p>mfg</p>
<p>HubertS</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129155</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129155</guid><dc:creator><![CDATA[Huberts]]></dc:creator><pubDate>Fri, 01 Sep 2006 13:43:26 GMT</pubDate></item><item><title><![CDATA[Reply to Time Stamp Counter &amp;lt;- optimieren, dass es nicht so sehr ruckelt on Fri, 01 Sep 2006 13:59:34 GMT]]></title><description><![CDATA[<p>Soll ichs dir sagen?</p>
<pre><code class="language-cpp">Timer1-&gt;Interval = 1;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1129177</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129177</guid><dc:creator><![CDATA[GCoder]]></dc:creator><pubDate>Fri, 01 Sep 2006 13:59:34 GMT</pubDate></item><item><title><![CDATA[Reply to Time Stamp Counter &amp;lt;- optimieren, dass es nicht so sehr ruckelt on Fri, 01 Sep 2006 14:23:18 GMT]]></title><description><![CDATA[<p>auch wenn ich das weg mache ruckelt es bei mir,<br />
wenn du dir das von rico sonntag angeschaut hast wirst du sehen,<br />
dass es sich sehr flüssig verschieben lässt,</p>
<p>mein programm läßt sich zwar verschieben, nur nicht flüssig,</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129198</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129198</guid><dc:creator><![CDATA[Huberts]]></dc:creator><pubDate>Fri, 01 Sep 2006 14:23:18 GMT</pubDate></item><item><title><![CDATA[Reply to Time Stamp Counter &amp;lt;- optimieren, dass es nicht so sehr ruckelt on Fri, 01 Sep 2006 14:39:14 GMT]]></title><description><![CDATA[<p>wahrscheinlich wird bei dem Programm von Rico Sonntag ein separater Thread zur Ermittlung der CPU-Speed verwendet</p>
<p>mehr zu Threads gibst <a href="http://bcb-tutorial.c-plusplus.net/Thread/index.html" rel="nofollow">hier</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129216</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129216</guid><dc:creator><![CDATA[Linnea]]></dc:creator><pubDate>Fri, 01 Sep 2006 14:39:14 GMT</pubDate></item><item><title><![CDATA[Reply to Time Stamp Counter &amp;lt;- optimieren, dass es nicht so sehr ruckelt on Tue, 05 Sep 2006 23:02:08 GMT]]></title><description><![CDATA[<p>so, es hat einige zeit gedauert,</p>
<p>ca. 5 Tage, bis ich das mit den threads verstanden habe,</p>
<p>wer sich mein fertiges projekt anschauen möchste,</p>
<p>der kann das von meiner neuen seite ziehen -&gt; <a href="http://www.hubert-s.de.vu" rel="nofollow">www.hubert-s.de.vu</a> ...unter download,</p>
<p>die habe ich extra für diesen anlass geproggt,<br />
vielleicht kommt mehr von mir dazu,</p>
<p>auf wunsch kann ich mein quellcode, entweder hier im forum oder auf meiner &quot;neuen&quot; seite zur verfügung stellen, entweder oder, oder da oder dort, oder gar nicht, :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1131927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1131927</guid><dc:creator><![CDATA[Huberts]]></dc:creator><pubDate>Tue, 05 Sep 2006 23:02:08 GMT</pubDate></item></channel></rss>