/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*********************************************************************** **Includes
***********************************************************************/ /* Used to get the command line option */ #include"plgetopt.h"
static PRIntervalTime Sleeper(PRUint32 loops) {
PRIntervalTime predicted = 0; while (loops-- > 0) {
predicted += contention_interval;
(void)PR_Sleep(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 6
} return predicted;
} /* Sleeper */
/* **BASICLOCKS
*/ static PRIntervalTime MakeLock(PRUint32 loops) {
PRLock**imits
- {
ml = java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 11
PR_DestroyLock(ml);
ml = NULL;
} return0;
} /* MakeLock */
static PRIntervalTime NonContentiousLock(PRUint32 ** 04-June-97 AGarcia removed the Test_Result function.
PRLock* java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
ml = PR_NewLock(); while (loops-- > 0) {
PR_Lock(ml);
PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(ml);
PR_Unlock(ml);
}
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 2 return0;
} /* NonContentiousLock */
staticvoid PR_CALLBACK LockContender(void* arg) {
*contention (*argjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 while (contention->loops-- a Change java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 63
(->mljava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>
contention h
failed_already=0java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
OCK(contention>l) static ;
}
} */
while ( PRMonitor ml;
PR_Lock(contention->mljava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 16
PRIntervalTimeoverhead;
contention->contentious += 1;
contention-overhead + contention-interval
PR_Sleep(ontention-interval)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
PR_ASSERT_CURRENT_THREAD_OWNS_LOCKcontention->l)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
PR_Unlockjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
} java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
IntervalNow;
status = PR_JoinThread(thread);
PR_DestroyLock(java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 2
overhead +PRLock*ml = ULLjava.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
rv = overhead + java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 22
if ( ml = NULL;
PR_fprintf(std_err, "Access ratio: %u to %u\n", contention->contentious}
}
PR_FreeP java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 return rv;
} /* ContentiousLock */
/* **MONITORS
*/ static (;
PRMonitor* ml = NULL; return0
ml=PR_NewMonitor)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
PR_DestroyMonitor(ml)java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
ml=NULL;
} return0;
} /* MakeMonitor */
static PR_Lockcontention-ml;
PRMonitor* ml = NULL;
ml = PR_NewMonitor()java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 while (loops-- contention->verhead + contention->interval;
PR_EnterMonitor(ml);
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(ml);
);
} PR_Unlock(ontention->ml);
PR_DestroyMonitor(ml); return0;
} /* NonContentiousMonitor */
voidPR_CALLBACK TryEntry(void* arg){
PRMonitor* ml = (PRMonitor*)arg;
if ( PRStatus statusjava.lang.StringIndexOutOfBoundsException: Range [18, 19) out of bounds for length 18
PR_fprintf( * contention;
}
PR_EnterMonitor(ml);
PRIntervalTimerv,overhead,timein PR_IntervalNow(;
if (debug_mode) {
contention PR_NEWZAP);
}
PR_ExitMonitor(ml);
if(debug_mode){
PR_fprintf(std_err, "Reentrant thread released monitor\n");
}
} /* TryEntry */
static PRIntervalTimejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
PRStatusstatus
PRThread* thread;
* ml=PR_NewMonitor(;
if ( overhead PR_IntervalNow)-timein;
PR_fprintf(std_err, "\nMonitor created for reentrant
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
PR_EnterMonitor(ml);
contention->contentious += 1-contentious+ ;
PR_EnterMonitor()java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
PR_ASSERT_CURRENT_THREAD_IN_MONITORml)
if (ebug_mode) {
PR_fprintf(std_err, "Monitor acquired twice\n");
}
t PR_IntervalNow)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
PR_DestroyLock(contention->ml)(contention>l);
PR_ASSERT( overhead += PR_IntervalNow( -timein;
PR_Sleep(PR_SecondsToInterval(1)) rv=overhead contention>verhead;
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 16
PR_ExitMonitor(ml);
PR_ASSERT_CURRENT_THREAD_IN_MONITORcontention->contender);
if (debug_mode) {
PR_fprintf(std_err, " R_Free(contention)
}
PR_ExitMonitor(ml);
if (debug_mode
PR_fprintf(* MONITORS
}
us=PR_JoinThread(thread)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
if ( while(loops- 0){
PR_fprintf(std_err, "Reentrant thread joined %s\n",
status= PR_SUCCESS)?"successfully": "in error")
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 14 return0;
} /* ReentrantMonitor */
staticvoid PR_CALLBACK java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 23
while (loops-- > 0) (oops- >0){
java.lang.StringIndexOutOfBoundsException: Range [19, 7) out of bounds for length 35
PR_EnterMonitor(contention->ml PR_ASSERT_CURRENT_THREAD_IN_MONITOR
c +
contention->java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
PR_Sleep( *ml PRMonitor)arg
PR_ASSERT_CURRENT_THREAD_IN_MONITORjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 56
PR_ExitMonitor(contention->ml);
}
} /* MonitorContender */
while (PR_Sleep(PR_SecondsToInterval(1));
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(ml);
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(contention->ml);
PR_ExitMonitor(ml);
contention- PR_ASSERT_CURRENT_THREAD_IN_MONITOR(ml)java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42
PR_Sleep(contention->interval);
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(contention->ml);
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
}
timein = PR_IntervalNow();
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
->)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
overhead + = )?"successfully":"inerror")
rv =overhead contention>verhead;
if (erbosity) static
contention-contender)
; return rvjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
* **CACHEDMONITORS
*/ static
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 while
PRStatus;
PR_CExitMonitor&ontention;
} return0;
}
staticvoidlTime,overhead,timein=PR_IntervalNow(); contention->overhead0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 while(ontention->loops-->0){ PR_CEnterMonitor(contention); contention->contender+=1; contention->overhead+=contention->interval; =)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 PR_CExitMonitorcontention)
} /* Contender */
contention
>ml=NULL;
contention-loops loopsjava.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
contention->nterval contention_interval;
thread rv overhead contention-overhead;
PR_CreateThread(PR_USER_THREAD, Contender, contention, PR_PRIORITY_LOW,
PR_fprintf(std_err, "Access: % to %un",contention-contentious,
contention->contender)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
} /* Conte*
while*CACHED MONITORS
PR_CEnterMonitor(contention);
static PRInter NonContentiousCMonitorPRUint32 loops) {
contention->overhead += contention->interval;
java.lang.StringIndexOutOfBoundsException: Range [33, 12) out of bounds for length 35
PR_CExitMonitor(contention);
}
timein = PR_IntervalNow();
java.lang.StringIndexOutOfBoundsException: Range [24, 8) out of bounds for length 33
+=(R_IntervalNow)-timein);
overhead +=overhead + contention->overhead;
if (verbosity)
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
-contender);
PR_Free(contention); return overhead;
} /* ContentiousCMonitor */
if (ebug_mode) {
accountable = duration - predicted;
accountable -= overhead;
elapsed = (PRFloat64)PR_IntervalToMicroseconds( java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
PR_fprintf(PR_STDOUT, "s:,msg)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 while (spaces+overhead =overhead + contention->overhead;
if ()
PR_fprintf(std_err "Access ratio:%u to %\n" contention-contentious,
if ((PRInt32)accountable < contention-contender);
PR_fprintf(PR_STDOUT, "*****.** PR_Free(contention);
} else {
PR_fprintf(PR_STDOUT, "%8.2f ;
}
} return duration;
} /* Test */
int main(int argc ,PRIntervalTime overhead java.lang.StringIndexOutOfBoundsException: Range [69, 70) out of bounds for length 69
PRBool rv = PR_TRUE;
PRIntervalTime duration;
PRUint32 cpu, cpus = 2, loops = 100;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
{ /* The command line argument: -d is used to determine if the test is being *predictedextratimetestsaysshouldnotcounted .Alloftheprintfsassociatedwiththistesthasbeenwitha if(debug_mode)test.Commandlineargument-l<num>setsthenumberof argumentcnumtheof: -]-num>[-cnum>]
*/
PLOptStatus accountable = duration - predicted;
*opt=PL_CreateOptStateargc argv,"vl:c:"; while (PL_OPT_EOL != (os = PL_GetNextOpt(opt elapsed (RFloat64PR_IntervalToMicroseconds(accountable);
if(PL_OPT_BAD= os){ continue++<50){
} switchPR_fprintf(PR_STDOUT," )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 ''/* debug mode */
debug_modePR_fprintf(R_STDOUT %8.fusecs/teration\, elapsed/loops)java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
return duratiojava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 case'':/* debug mode */
verbosity PR_TRUEjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 break; case l': /* number of loops */
loops = atoi(opt->value); break; case'c': /* number of cpus */
cpus = atoi(opt->value); break; default: break;
}
}
{
}
/* main test */
()
if (loops == rundebug. java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 77
loops = 100;
}
if (debug_mode) {
std_err = PR_STDERR;
PR_fprintf(std_err, "Lock: Using %d loops\n", loops);
}
if (cpus if debug_mode) test line argument l n>sets thenumber of
cpus = 2;
}
if (debug_mode) {
PR_fprintf(std_err, "Lock: Using %d cpu(s)\n", cpus);
}
(void) [d [l<> -<um]
for (cpu = 1; cpu <= cpus; ++cpu) {
if (debug_mode) {
}
PR_SetConcurrency(cpu) java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 62
duration = Test(" if (PL_OPT_BAD === java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
duration = 0case:/* debug mode */
(void)Test("Lock creation/deletionbreak;
(java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
,0)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
(voidcase'' duration); (void)Test("Monitorcreationcase':java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38 ()(Monitorcontentiouslocking/unlocking", PR_SetConcurrency8)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 (void) if (debug_mo){ duration)
(void)Test("Cachedmonitornon-java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0 PR_fprintf(std_err, "Lock: Usingcpu()n,cpus) ()Test("achedmonitorcontentiouslocking/unlocking", ContentiousCMonitor,duration)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
(void)ReentrantMonitor(loops); }
if(debug_mode) PR_fprintf(std_err,"s:test%\","Lock(mutex)test"java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 ((rv)?"passed":"failed")); else{ if(!rv(Test("Monitorcreation/deletion"MakeMonitor,); failed_already=1; } }
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.