English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés
Σ: 1 post

TCH  (statz) Főfasz
#1, Főfasz (10443)
2622 | #299f | ^ | Idézet | Sun, 29 Dec 2013 18:00:24 +01
31.46.*.* Linux x86 Opera Classic Hungary *.catv.pool.telekom.hu
@TCH:
Max esetleg úgy, hogy méri 10 másodpercig és a várt/mért különbségből számol egy offsetet. De akkor így a program inicializálása baromi sokáig fog tartani.
Viszont vehetünk kisebb időszeletet is, maximum a mérés nem lesz annyira pontos. Én most átírtam a mérést:
unit cusleep_lib;

interface

procedure cusleep(usec: longint);
procedure init_cusleep;

implementation

uses unix;

var
	cusleep_time: longint;

procedure cusleep(usec: longint); assembler;
label l0;
asm

	{$ifdef cpu386}
	movl usec, %eax
	movl cusleep_time, %ecx
	mul %ecx
	xorl %ecx, %ecx
	l0:
	incl %ecx
	cmpl %eax, %ecx
	jne l0
	{$endif cpu386}

	{$ifdef cpux86_64}
	movl usec, %eax
	movl cusleep_time, %ecx
	mul %ecx
	xorl %ecx, %ecx
	l0:
	incl %ecx
	cmpl %eax, %ecx
	jne l0
	{$endif cpux86_64}

	{$ifdef cpupowerpc}
	ld r1, 0(usec)
	ld r0, 0(cusleep_time)
	mul r0, r0, r1
	xor r1, r1, r1
	l0:
	addi r1, r1, 1
	cmp cr0, 1, r0, r1
	bne cr0, l0
	{$endif cpupowerpc}

end;

procedure init_cusleep;
var
	bt: int64;
	tv: timeval;
	i: longint;
label l0;
begin
	fpgettimeofday(@tv, nil);
	bt := (tv.tv_sec * 1000000) + tv.tv_usec;
	asm

		{$ifdef cpu386}
		xorl %eax, %eax
		xorl %ecx, %ecx
		l0:
		incl %ecx
		cmpl %eax, %ecx
		jne l0
		{$endif cpu386}

		{$ifdef cpux86_64}
		xorl %eax, %eax
		xorl %ecx, %ecx
		l0:
		incl %ecx
		cmpl %eax, %ecx
		jne l0
		{$endif cpux86_64}

		{$ifdef cpupowerpc}
		xor r0, r0, r0
		xor r1, r1, r1
		l0:
		addi r1, r1, 1
		cmp cr0, 1, r0, r1
		bne cr0, l0
		{$endif cpupowerpc}

	end;
	fpgettimeofday(@tv, nil);
	cusleep_time := ($100000000 div (((tv.tv_sec * 1000000) + tv.tv_usec) - bt));
	
	bt := (tv.tv_sec * 1000000) + tv.tv_usec;
	for i := 1 to 1000000 do
	begin
		cusleep(1);
	end;
	fpgettimeofday(@tv, nil);
	cusleep_time := cusleep_time - (((((tv.tv_sec * 1000000) + tv.tv_usec) - bt) - 1000000) div 1000);
end;

end.
Amint látjátok, itt az inicializáló, a ciklusmérés után, mindjárt mér is egy másodpercet a timer függvénnyel, aztán a mért eredményből kivonja a vártat és az eredményt osztja ezerrel (lévén ugye itt µszekundumokat mértünk, de nanoszekundumokat számolunk) és az egészet kivonja az eredeti ciklusszámból. Az operandusok előjelesek, azaz, ha épp hosszabbítani kellene a várakozást, akkor negatív számot von ki (azaz összead), tehát mind a két irányba jó.
A végeredmény elég jó, a mért/várt különbség ~0.5%-ról ~0.07%-ra csökkent, azaz valamivel egy ezrelék alá. Tehát most már egy µszekundum alatt kevesebbet csúszik, mint 1 ns.


English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés

Név: (max 255 byte)

Email: (max 255 byte) Nem kötelező!

Üzenet: (max 65536 kar.) 65536-0=65536




crap_vkn v4.34.0 by TCH
Thx to saxus for the escaped string decoder function (PHP), the realIP function (PHP) & the SQL handle layer (PHP), to thookerov for the int_divide function (PHP), to Jeff Anderson for the getSelText function (JS), to Alex King for the insertAtCursor function (JS), Flood3r for the new CSS styles, Pety for the spamprotection idea and some design and comfort ideas, MaxMind for the IP2Country database, famfamfam for the flags of countries and an unknown PHP programmer for the removeAccents function.



Kecskebaszók ide!