<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Не корректная работа sleep]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17635</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17635&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Не корректная работа sleep».]]></description>
		<lastBuildDate>Sun, 12 Mar 2023 18:43:40 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157130#p157130</link>
			<description><![CDATA[<p>Точнее будет сказать, что нагрузка возникает из-за применения этой фичи.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 12 Mar 2023 18:43:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157130#p157130</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157128#p157128</link>
			<description><![CDATA[<p>Ничего не удивляет, я спросил, ты говоришь про нагрузку со стороны одного процесса?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 12 Mar 2023 18:36:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157128#p157128</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157127#p157127</link>
			<description><![CDATA[<p>А что тебя удивляет? Нагрузка не всегда исчерпывается отображаемым в Диспетчере задач процентом.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 12 Mar 2023 18:35:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157127#p157127</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157126#p157126</link>
			<description><![CDATA[<p>Со стороны одного процесса?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 12 Mar 2023 18:22:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157126#p157126</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157124#p157124</link>
			<description><![CDATA[<p>Чтобы снизить нагрузку на систему же.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 12 Mar 2023 18:21:09 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157124#p157124</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157121#p157121</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Почему не нужен</p></blockquote></div><p>А зачем нужен?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 12 Mar 2023 17:56:12 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157121#p157121</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157114#p157114</link>
			<description><![CDATA[<p>Почему не нужен, то, что ты процитировал выше, тоже верно, нагрузка на систему увеличивается.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 12 Mar 2023 13:30:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157114#p157114</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157113#p157113</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>MsgBox % mod(100, 3)</p></blockquote></div><p>Убедил, просто у меня больше 1го не было.<br /></p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Starting with Windows 10, version 2004, this function no longer affects global timer resolution.</p></blockquote></div><p>То есть это настройка для текущего процесса? timeEndPeriod становится не нужен в контексте постоянной необходимости DllCall(&quot;Sleep&quot;, &quot;UInt&quot;, ms)?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 12 Mar 2023 12:36:20 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157113#p157113</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157111#p157111</link>
			<description><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>погрешность на практике 1 мс, что то не работает.</p></blockquote></div><p>А почему 1 не может быть?<br /></p><div class="codebox"><pre><code>MsgBox % mod(100, 3)</code></pre></div><p>Ну и некоторая погрешность измерения возможно остаётся.</p><div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Если настройка глобальная и не особо полезная, не лучше её сразу отключать?</p></blockquote></div><p>Так у меня иногда погрешность до 7 вырастает. Кроме того, такой Sleep чаще всего используется в цикле, чтобы получить минимальную, но не нулевую паузу. Если менять эту настройку каждые несколько милисекунд, возможно будет сказываться на производительности, и не сойдёт ли с ума компьютер? Кроме того, <br /></p><div class="quotebox"><blockquote><p>Starting with Windows 10, version 2004, this function no longer affects global timer resolution.</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 12 Mar 2023 11:10:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157111#p157111</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157109#p157109</link>
			<description><![CDATA[<p><strong>teadrinker</strong><br />В коде uPeriod = 3, но погрешность на практике 1 мс, что то не работает.</p><p><a href="https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod">https://learn.microsoft.com/en-us/windo … eginperiod</a><br /></p><div class="quotebox"><blockquote><p>Установка более высокого разрешения может повысить точность интервалов времени ожидания в функциях ожидания. Однако это также может снизить общую производительность системы, поскольку планировщик потоков чаще переключает задачи.</p></blockquote></div><p>Если настройка глобальная и не особо полезная, не лучше её сразу отключать?<br /></p><div class="codebox"><pre><code>
   Sleep(ms) {
		DllCall(&quot;Winmm\timeBeginPeriod&quot;, &quot;UInt&quot;, 3)
		DllCall(&quot;Sleep&quot;, &quot;UInt&quot;, ms)
		DllCall(&quot;Winmm\timeEndPeriod&quot;, &quot;UInt&quot;, 3) 
   }
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 12 Mar 2023 06:54:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157109#p157109</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157108#p157108</link>
			<description><![CDATA[<p>Получается QueryPerformanceCounter точнее чем A_TickCount.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 12 Mar 2023 06:43:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157108#p157108</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157064#p157064</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Хотя у меня особой разницы в точности это не даёт.</p></blockquote></div><p>На самом деле даёт, надо просто правильно замерять:<br /></p><div class="codebox"><pre><code>SetBatchLines, -1
DllCall(&quot;QueryPerformanceFrequency&quot;, &quot;Int64P&quot;, frequency)
PS := new PreciseSleep()

DllCall(&quot;QueryPerformanceCounter&quot;, &quot;Int64P&quot;, start1)
PS.Sleep(100)
DllCall(&quot;QueryPerformanceCounter&quot;, &quot;Int64P&quot;, end1)

DllCall(&quot;QueryPerformanceCounter&quot;, &quot;Int64P&quot;, start2)
PS.Sleep(1200)
DllCall(&quot;QueryPerformanceCounter&quot;, &quot;Int64P&quot;, end2)

PS := &quot;&quot;
MsgBox, % (end1 - start1)/frequency * 1000 . &quot;`n&quot; . (end2 - start2)/frequency * 1000

class PreciseSleep {
   __New(TimePeriod := 3) {
      this.timePeriod := TimePeriod
      DllCall(&quot;Winmm\timeBeginPeriod&quot;, &quot;UInt&quot;, TimePeriod)
   }
   __Delete() {
      DllCall(&quot;Winmm\timeEndPeriod&quot;, &quot;UInt&quot;, this.timePeriod)
   }
   Sleep(ms) {
      DllCall(&quot;Sleep&quot;, &quot;UInt&quot;, ms)
   }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 09 Mar 2023 18:24:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157064#p157064</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157063#p157063</link>
			<description><![CDATA[<p>Можно так попробовать:<br /></p><div class="codebox"><pre><code>SetBatchLines, -1
PS := new PreciseSleep
start := A_TickCount
PS.Sleep(1000)
end := A_TickCount - start
PS := &quot;&quot;
MsgBox, % end

class PreciseSleep {
   __New(TimePeriod := 3) {
      this.timePeriod := TimePeriod
      DllCall(&quot;Winmm\timeBeginPeriod&quot;, &quot;UInt&quot;, TimePeriod)
   }
   __Delete() {
      DllCall(&quot;Winmm\timeEndPeriod&quot;, &quot;UInt&quot;, this.timePeriod)
   }
   Sleep(ms) {
      DllCall(&quot;Sleep&quot;, &quot;UInt&quot;, ms)
   }
}</code></pre></div><p>Хотя у меня особой разницы в точности это не даёт.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 09 Mar 2023 16:35:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157063#p157063</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157056#p157056</link>
			<description><![CDATA[<p><strong>ypppu</strong>, боюсь, всё это не имеет отношения к вопросу.</p><div class="quotebox"><cite>pwch пишет:</cite><blockquote><p>Можете в таком случае подсказать как через QueryPerformanceCounter реализовать альтернативу sleep</p></blockquote></div><p>Он не может. По всей вероятности, как я упомянул, этот текст сформирован ChatGPT.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 09 Mar 2023 16:09:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157056#p157056</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Не корректная работа sleep]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=157055#p157055</link>
			<description><![CDATA[<p><strong>pwch</strong>, в AutoHotkey по умолчанию присутствуют всякие-разные встроенные задержки, которые первоначально не равны нулю, и их можно настраивать соответствующими командами:<br /></p><ul><li><p>SetKeyDelay</p></li><li><p>SetControlDelay</p></li><li><p>SetMouseDelay</p></li><li><p>SetWinDelay</p></li><li><p>SetBatchLines</p></li></ul><p>Прочитайте соответствующие статьи в справке, уверен, много прояснится.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Thu, 09 Mar 2023 15:40:01 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=157055#p157055</guid>
		</item>
	</channel>
</rss>
