Changeset 102390 in vbox for trunk/src/libs/xpcom18a4/xpcom/reflect
- Timestamp:
- Nov 30, 2023 8:12:27 AM (15 months ago)
- svn:sync-xref-src-repo-rev:
- 160526
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
r86423 r102390 44 44 #include "xptcall.h" 45 45 #include "prlong.h" 46 #include "prinrval.h"47 46 #include "nsMemory.h" 48 47 … … 54 53 55 54 #include <iprt/string.h> 55 #include <iprt/time.h> 56 56 57 57 static char g_szDirect[16384]; … … 1438 1438 static const int count = 100000000; 1439 1439 int i; 1440 PRIntervalTimestart;1441 PRIntervalTimeinterval_direct;1442 PRIntervalTimeinterval_invoke;1440 uint64_t start; 1441 uint64_t interval_direct; 1442 uint64_t interval_invoke; 1443 1443 1444 1444 printf("Speed test...\n\n"); 1445 1445 printf("Doing %d direct call iterations...\n", count); 1446 start = PR_IntervalNow();1446 start = RTTimeNanoTS(); 1447 1447 for(i = count; i; i--) 1448 1448 (void)test->AddTwoInts(in1, in2, &out); 1449 interval_direct = PR_IntervalNow() - start;1449 interval_direct = RTTimeNanoTS() - start; 1450 1450 1451 1451 printf("Doing %d invoked call iterations...\n", count); 1452 start = PR_IntervalNow();1452 start = RTTimeNanoTS(); 1453 1453 for(i = count; i; i--) 1454 1454 (void)XPTC_InvokeByIndex(test, 3, 3, var); 1455 interval_invoke = PR_IntervalNow() - start;1455 interval_invoke = RTTimeNanoTS() - start; 1456 1456 1457 1457 printf(" direct took %0.2f seconds\n", 1458 (double)interval_direct/(double) PR_TicksPerSecond());1458 (double)interval_direct/(double)RT_NS_1SEC); 1459 1459 printf(" invoke took %0.2f seconds\n", 1460 (double)interval_invoke/(double) PR_TicksPerSecond());1460 (double)interval_invoke/(double)RT_NS_1SEC); 1461 1461 printf(" So, invoke overhead was ~ %0.2f seconds (~ %0.0f%%)\n", 1462 (double)(interval_invoke-interval_direct)/(double) PR_TicksPerSecond(),1462 (double)(interval_invoke-interval_direct)/(double)RT_NS_1SEC, 1463 1463 (double)(interval_invoke-interval_direct)/(double)interval_invoke*100); 1464 1464 }
Note:
See TracChangeset
for help on using the changeset viewer.