Changeset 102178 in vbox
- Timestamp:
- Nov 21, 2023 9:20:06 AM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 160303
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
r102176 r102178 115 115 */ 116 116 117 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP118 #define PT_FPrintStats VBoxNsprPT_FPrintStats119 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */120 121 117 PR_BEGIN_EXTERN_C 122 118 … … 181 177 #define PT_THREAD_RESUMED 0x80 /* thread has been resumed */ 182 178 #define PT_THREAD_SETGCABLE 0x100 /* set the GCAble flag */ 183 184 #if defined(DEBUG)185 186 typedef struct PTDebug187 {188 PRTime timeStarted;189 PRUintn locks_created, locks_destroyed;190 PRUintn locks_acquired, locks_released;191 PRUintn cvars_created, cvars_destroyed;192 PRUintn cvars_notified, delayed_cv_deletes;193 } PTDebug;194 195 #endif /* defined(DEBUG) */196 197 NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg);198 179 199 180 /************************************************************************/ -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prtime.h
r11551 r102178 56 56 #define PR_ImplodeTime VBoxNsprPR_ImplodeTime 57 57 #define PR_NormalizeTime VBoxNsprPR_NormalizeTime 58 #define PR_LocalTimeParameters VBoxNsprPR_LocalTimeParameters59 #define PR_GMTParameters VBoxNsprPR_GMTParameters60 #define PR_USPacificTimeParameters VBoxNsprPR_USPacificTimeParameters61 #define PR_ParseTimeString VBoxNsprPR_ParseTimeString62 #define PR_FormatTime VBoxNsprPR_FormatTime63 #define PR_FormatTimeUSEnglish VBoxNsprPR_FormatTimeUSEnglish64 58 #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */ 65 59 … … 231 225 PRExplodedTime *exploded, PRTimeParamFn params); 232 226 233 /**********************************************************************/234 /*********************** TIME PARAMETER FUNCTIONS *********************/235 /**********************************************************************/236 237 /* Time parameters that suit current host machine */238 NSPR_API(PRTimeParameters) PR_LocalTimeParameters(const PRExplodedTime *gmt);239 240 /* Time parameters that represent Greenwich Mean Time */241 NSPR_API(PRTimeParameters) PR_GMTParameters(const PRExplodedTime *gmt);242 243 /*244 * Time parameters that represent the US Pacific Time Zone, with the245 * current daylight saving time rules (for testing only)246 */247 NSPR_API(PRTimeParameters) PR_USPacificTimeParameters(const PRExplodedTime *gmt);248 249 /*250 * This parses a time/date string into a PRTime251 * (microseconds after "1-Jan-1970 00:00:00 GMT").252 * It returns PR_SUCCESS on success, and PR_FAILURE253 * if the time/date string can't be parsed.254 *255 * Many formats are handled, including:256 *257 * 14 Apr 89 03:20:12258 * 14 Apr 89 03:20 GMT259 * Fri, 17 Mar 89 4:01:33260 * Fri, 17 Mar 89 4:01 GMT261 * Mon Jan 16 16:12 PDT 1989262 * Mon Jan 16 16:12 +0130 1989263 * 6 May 1992 16:41-JST (Wednesday)264 * 22-AUG-1993 10:59:12.82265 * 22-AUG-1993 10:59pm266 * 22-AUG-1993 12:59am267 * 22-AUG-1993 12:59 PM268 * Friday, August 04, 1995 3:54 PM269 * 06/21/95 04:24:34 PM270 * 20/06/95 21:07271 * 95-06-08 19:32:48 EDT272 *273 * If the input string doesn't contain a description of the timezone,274 * we consult the `default_to_gmt' to decide whether the string should275 * be interpreted relative to the local time zone (PR_FALSE) or GMT (PR_TRUE).276 * The correct value for this argument depends on what standard specified277 * the time string which you are parsing.278 */279 280 NSPR_API(PRStatus) PR_ParseTimeString (281 const char *string,282 PRBool default_to_gmt,283 PRTime *result);284 285 /*286 * FIXME: should we also have a formatting function, such as asctime, ctime,287 * and strftime in standard C library? But this would involve288 * internationalization issues. Might want to provide a US English version.289 */290 291 /**********************************************************************/292 /*********************** OLD COMPATIBILITYFUNCTIONS *******************/293 /**********************************************************************/294 #ifndef NO_NSPR_10_SUPPORT295 296 /* Format a time value into a buffer. Same semantics as strftime() */297 NSPR_API(PRUint32) PR_FormatTime(char *buf, int buflen, const char *fmt,298 const PRExplodedTime *tm);299 300 /* Format a time value into a buffer. Time is always in US English format, regardless301 * of locale setting.302 */303 NSPR_API(PRUint32)304 PR_FormatTimeUSEnglish( char* buf, PRUint32 bufSize,305 const char* format, const PRExplodedTime* tm );306 307 #endif /* NO_NSPR_10_SUPPORT */308 309 227 PR_END_EXTERN_C 310 228 -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c
r102063 r102178 123 123 pr_ContuationStatus status; /* the status of the operation */ 124 124 }; 125 126 #if defined(DEBUG)127 128 PTDebug pt_debug; /* this is shared between several modules */129 130 PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)131 {132 PTDebug stats;133 char buffer[100];134 PRExplodedTime tod;135 PRInt64 elapsed, aMil;136 stats = pt_debug; /* a copy */137 PR_ExplodeTime(stats.timeStarted, PR_LocalTimeParameters, &tod);138 (void)PR_FormatTime(buffer, sizeof(buffer), "%T", &tod);139 140 LL_SUB(elapsed, PR_Now(), stats.timeStarted);141 LL_I2L(aMil, 1000000);142 LL_DIV(elapsed, elapsed, aMil);143 144 if (NULL != msg) PR_fprintf(debug_out, "%s", msg);145 PR_fprintf(146 debug_out, "\tstarted: %s[%lld]\n", buffer, elapsed);147 PR_fprintf(148 debug_out, "\tlocks [created: %u, destroyed: %u]\n",149 stats.locks_created, stats.locks_destroyed);150 PR_fprintf(151 debug_out, "\tlocks [acquired: %u, released: %u]\n",152 stats.locks_acquired, stats.locks_released);153 PR_fprintf(154 debug_out, "\tcvars [created: %u, destroyed: %u]\n",155 stats.cvars_created, stats.cvars_destroyed);156 PR_fprintf(157 debug_out, "\tcvars [notified: %u, delayed_delete: %u]\n",158 stats.cvars_notified, stats.delayed_cv_deletes);159 } /* PT_FPrintStats */160 161 #else162 163 PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)164 {165 /* do nothing */166 } /* PT_FPrintStats */167 168 #endif /* DEBUG */169 125 170 126 /* … … 434 390 void _PR_InitIO(void) 435 391 { 436 #if defined(DEBUG)437 memset(&pt_debug, 0, sizeof(PTDebug));438 pt_debug.timeStarted = PR_Now();439 #endif440 441 392 _pr_rename_lock = PR_NewLock(); 442 393 Assert(NULL != _pr_rename_lock); -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c
r102173 r102178 58 58 static pthread_mutexattr_t _pt_mattr; 59 59 static pthread_condattr_t _pt_cvar_attr; 60 61 #if defined(DEBUG)62 extern PTDebug pt_debug; /* this is shared between several modules */63 #endif /* defined(DEBUG) */64 60 65 61 /**************************************************************/ … … 134 130 } 135 131 } 136 #if defined(DEBUG)137 pt_debug.cvars_notified += 1;138 if (0 > ASMAtomicDecS32(&cv->notify_pending))139 {140 pt_debug.delayed_cv_deletes += 1;141 PR_DestroyCondVar(cv);142 }143 #else /* defined(DEBUG) */144 132 if (0 > ASMAtomicDecS32(&cv->notify_pending)) 145 133 PR_DestroyCondVar(cv); 146 #endif /* defined(DEBUG) */147 134 } 148 135 prev = notified; … … 165 152 Assert(0 == rv); 166 153 } 167 #if defined(DEBUG)168 pt_debug.locks_created += 1;169 #endif170 154 return lock; 171 155 } /* PR_NewLock */ … … 182 166 #if defined(DEBUG) 183 167 memset(lock, 0xaf, sizeof(PRLock)); 184 pt_debug.locks_destroyed += 1;185 168 #endif 186 169 PR_DELETE(lock); … … 198 181 lock->locked = PR_TRUE; 199 182 lock->owner = pthread_self(); 200 #if defined(DEBUG)201 pt_debug.locks_acquired += 1;202 #endif203 183 } /* PR_Lock */ 204 184 … … 223 203 else pt_PostNotifies(lock, PR_TRUE); 224 204 225 #if defined(DEBUG)226 pt_debug.locks_released += 1;227 #endif228 205 return PR_SUCCESS; 229 206 } /* PR_Unlock */ … … 329 306 cv->lock = lock; 330 307 cv->notify_pending = 0; 331 #if defined(DEBUG)332 pt_debug.cvars_created += 1;333 #endif334 308 } 335 309 return cv; … … 341 315 { 342 316 PRIntn rv = pthread_cond_destroy(&cvar->cv); Assert(0 == rv); 343 #if defined(DEBUG)344 memset(cvar, 0xaf, sizeof(PRCondVar));345 pt_debug.cvars_destroyed += 1;346 #endif347 317 PR_DELETE(cvar); 348 318 }
Note:
See TracChangeset
for help on using the changeset viewer.