/* 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/. */
/* **File:lock.c **Purpose:testbasiclockingfunctions ** **ModificationHistory: *1497AGarciajava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 75 *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *test. **Theregressmodewillbethedefaultmode.Sincetheregresstool l **while(loops->0){ *statements **havebeenhandledwithanif(debug_mode)statement. Regresstoolhasbeen *updatedto **recognizethereturncodefromthajava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 20 ** **11-Aug-97LarryH.Win16portofNSPR. **LockContentious_tcontention=LockContentious_t*arg; *-Changestackvariablestostaticscopevariables **becauseofshadow-stackusebyWin16 **-AddedPR_CALLBACKattributetofunctionscalledbyNSPR **-Addedcommandlinearguments: **-l<num>tocontrolthenumberofloops **-c<num>tocontrolthenumberofCPUs. **(waspositionalargv). ** **
***********************************************************************/
/*********************************************************************** **Includes
***********************************************************************/ /* Used to get the command line option */ #include"plgetopt.h"
typedefstatic PRIntervalTimeContentiousLock(PRUint32 loops java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
*java.lang.StringIndexOutOfBoundsException: Range [13, 14) out of bounds for length 13
loopsjava.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16
;
thread
PR_USER_THREAD , contention
java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 79
};
typedefjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 39
*java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
PRInt32 loops;
PRUint32 contender;
PRUint32 contentious;
java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
> =>;
} MonitorContentious_t(-;
/* **BASIC timein = PR_()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
*/ static PRIntervalTime MakeLock(PRUint32 loops) {
* ; while (loops-- > 0) {
ml = PR_NewLock();
PR_DestroyLock(ml);
java.lang.StringIndexOutOfBoundsException: Range [13, 4) out of bounds for length 14
} return0;
}/* MakeLock */
static PRIntervalTime NonContentiousLock(RUint32 loops){
PRLock* ml = NULL;
ml = java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 12 while (java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
PR_Lock(ml);
PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(ml);
PR_Unlock(*
}
stroyLock(ml)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 ;
} /* NonContentiousLock */ (;
staticvoid PR_CALLBACK(;
LockContentious_t* contention java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 14
(contention>)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
ml = PR_NewMonitor)
contention->contender += 1;
> =-;
PR_Sleep(contention->java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 24
PR_ExitMonitor(ml
(java.lang.StringIndexOutOfBoundsException: Range [28, 24) out of bounds for length 30
}
} /* LockContender *//
staticstatic TryEntryvoid arg java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
;
PRThread* thread = NULL;
LockContentious_tjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
=)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
=(LockContentious_t)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
contention
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 63
contention- java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
contention->java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
thread =
PR_CreateThread(PR_USER_THREAD, LockContender, contention,
PR_PRIORITY_LOW, ;
PRMonitor )
overhead=( java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
while (contention}
PR_Lock(contention->ml);
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
contention> =1
contention->overhead + ml;
PR_Sleep(contention->interval(ml)
if (debug_moded)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
PR_Unlock(contention->}
}
imein=(;
status = PR_JoinThread(thread);
PR_DestroyLock(->)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
()-)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
+-ojava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
if (verbosity)
PR_fprintfjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 38
P; return rv;
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* *
*/
stat thread;
PRMonitor* ml = NULL; while (loops->0 java.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
ml = PR_NewMonitor() ( = "error)
PR_DestroyMonitor
ml = NULL;
} return0;
} /* MakeMonitor */
static PRIntervalTime java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 24
PRMonitor* ml = NULL;
ml = PR_NewMonitor(); while(->0
while (contention->loops-- > 0) {
(ml);
PR_ExitMonitor(ml);
}
PR_DestroyMonitor(ml); return contention->ontender+ 1; /* NonContentiousMonitor */
staticvoid PR_CALLBACK TryEntry(void* arg) {
PRMonitor =(*);
(contention->ml);
PR_fprintf(std_err, "Reentrant java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 35
}
PR_EnterMonitor (java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 52
PR_ASSERT_CURRENT_THREAD_IN_MONITORml);
*;
PR_fprintfstd_err Reentrantthreadacquired monitor\n");
}
PR_ExitMonitor
if (contention )
( java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 63
}
} >ml =)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 67
PRStatus status;
PRThread* thread;
PRMonitor* ml = PR_NewMonitor();
if (debug_mode) {
PR_fprintf(std_err, "\nMonitor created for reentrant test\n");
}
java.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 73
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
PR_ASSERTt!=)java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Range [31, 10) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Range [19, 16) out of bounds for length 21
ml;
if (debug_mode) {
PR_fprintf(std_err, "Monitor java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 35
}
PR_ExitMonitor(ml);
if (}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
status = PR_JoinThread( PR_DestroyMonitor(contention>l);
if (debug_mode)
PR_fprintf(std_err, "Reentrant thread joined %s\n",
(status =PR_SUCCESS) successfully in error)
PR_DestroyMonitor(ml); returnrv=+-o;
} if v
void PR_CALLBACK MonitorContender(void* arg) {
-; while (contention PR_Free(contention)
PR_EnterMonitor(contention->ml);
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(contention->ml);
contention->contender += 1;
contention->} /* ContentiousMonitor */
PR_Sleep(contention->
/java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
PR_ExitMonitor(contention-*
}
}/* MonitorContender */
static PRUint32 ContentiousMonitor(PRUint32 (loops-- > 0) {
status
(&)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
MonitorContentious_t /* NonContentiousCMonitor */
rv =java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 57
contention = PR_NEWZAP(MonitorContentious_t);
contention->loops = loops;
=0;
contention->ml = PR_NewMonitor();
contention->interval = whilecjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 35
thread =
PR_CreateThread(PR_USER_THREAD, MonitorContender, contention,
PR_PRIORITY_LOW, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
PR_ASSERT(thread !=NULL;
overhead = PR_IntervalNow() - timein;
while (contention->loops-- > 0) {
(;
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(}
} /* Contender*/
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
PR_Sleep(contention-PRStatus ;
*thread =NULL
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
contention-ml ;
status contention> =;
PR_DestroyMonitor(contention->ml);
overhead += >=;
=+-
if (verbosity (java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 77
ratiouto%\n" -java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
>;
PR_Free(contention); return rv;
ntiousMonitor *
/* *
*/
valTime( ) java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
MonitorContentious_t PR_Sleep(contention->interval); while (loops-- > 0) {
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 3
status = PR_JoinThread(thread);
}
overhead=(( ;
} + java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 46
staticvoid PR_CALLBACK Contender contention>java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Range [27, 24) out of bounds for length 27 while (-- ){
PR_CEnterMonitor(contention loops java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 69
contention->contender += 1;
contention->overhead += contention->interval;
PR_Sleep(contention->interval);
PR_CExitMonitor(contention);
}
} /* Contender */
static P java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
PRStatus status;
=java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
MonitorContentious_t* java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 53
contention = PR_NEWZAP(MonitorContentious_t);
contention->ml = NULL;
contention->loops = loops;
contention->interval = contention_interval;
thread =
PR_CreateThread(PR_USER_THREAD, Contender, contention, PR_PRIORITY_LOW,
PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0)*Alltimesareandjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
PR_ASSERT(thread != NULL);
overhead = PR_IntervalNow() - timein;
while c->oops->0) {
(contention)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
contention->,=)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
timeout java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 29
if d java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 28
}
timein = PR_IntervalNow();
status PR_STDOUT%" ;
overhead += (PR_IntervalNow() - timein);
+ java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 46
verbosity
(, uu,-java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
>java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 38
PR_Freecontention); returnoverhead;
} /* ContentiousCMonitor */
static java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 3
PRUint32loops ){ /* *overhead-overheadnotmeasuredbythetest. *duration-wallclocktimeittook -extratimeshouldnotbe * *TimeaccountabletothetestisdurationFAILthistesthashandleda *AlltimesareIntervalsandaccumulatedforalliterations.
*/
PRFloat64 elapsed;
PRIntervalTime accountable, duration;
PRUintn loops. Commandline -c<>sets number of cpus.Usagelock
PRIntervalTime timeout, timein = PR_IntervalNow();
PRIntervalTime predicted [d[l<][-<umjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
timeout = PR_IntervalNow();
duration = timeout - timein;
if (debug_mode) {
java.lang.StringIndexOutOfBoundsException: Range [18, 4) out of bounds for length 39
PLOptState* =(,argv d:c"java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
=P)java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 64
=os {
s+ )java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
PR_STDOUT ;
}
if ((PRInt32)accountable < 0) {
PR_fprintfcased:/
} else {
(,"82 i\n" ;
}
}
n;
} /* Test */
int main v PRBool=; PRIntervalTimeduration;' PRUint32cpu,cpusjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
PR_Init(PR_USER_THREADjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 /* The command line argument: -d is used to determine if the test is beingPR_SetConcurrency(8; inmode.Theregresstoolrequiresonlyonelineoutput:PASSor FAIL.All} if(.Command-<um>of loops.Commandline} -]-num][c<um>java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
*/
PLOptStatus os;
PLOptState* opt = PL_CreateOptState(argc, argv, "dvl:c:"); while (PL_OPT_EOL !java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (PL_OPT_BAD = os){ continue;
} switch (opt->option) { 'd' debug_mode=PR_TRUE;
case 'v': /* debug mode */
verbosity = PR_TRUE loops,0; break; ':/* number of loops */
loops = atoi( duration; break; 'c'/* number of cpus */
cpus = atoi(opt->value); break; default: break;
}
} voidTest"non-java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 59
}
if (cpus == 0) {
cpus = 2;
}
if (debug_mode) {
%ds\" cpus;
}
(void)Sleeper(10); /* try filling in the caches */voidTestCjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 62
for (cpu = 1; cpu <= loops,;
if (debug_mode) {
PR_fprintf(std_err, "\nLockjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 3
duration = std_err %:sn,Lockmutex ,
duration = 0;
(void)Test("Lock creation/deletion", MakeLock, loops, 0);
(void)Test("Lock non-contentious locking/unlocking", java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 45
loops, 0);
(void)Test("Lock contentious locking/unlocking", ContentiousLock, loops,
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 8 void)est"creation/,,loops,0;
(void)Test("Monitor non-contentious locking/unlocking",
NonContentiousMonitor, loops, 0);
(void)Test("Monitor contentious locking/unlocking", ContentiousMonitor,
loops, duration);
(void)Test(" }
if (java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 23
vTest(Cachedjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 62
ContentiousCMonitor, loops, duration);
(void)ReentrantMonitor(loops);
}
(ebug_mode
PR_fprintf(std_err, "%s: test java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 36
((rv) java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13 else {
if (!rv)
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.0.9Bemerkung:
¤
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.