Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add another timer on pcache1TruncateUnsafe(). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | debug |
Files: | files | file ages | folders |
SHA1: |
42ce53f648a506d0a5d9c1231eb28c11 |
User & Date: | drh 2016-08-09 11:44:06.664 |
Context
2016-08-10
| ||
02:54 | Remove all timers and other debugging logs except for the one timer on pcache1TruncateUnsafe(). (check-in: 5980e625db user: drh tags: debug) | |
2016-08-09
| ||
11:44 | Add another timer on pcache1TruncateUnsafe(). (check-in: 42ce53f648 user: drh tags: debug) | |
11:23 | Add a debug timer to pcache1Truncate(). Change the formatting of some other messages to make them easier to read. (check-in: 7d0af4b53c user: dan tags: debug) | |
Changes
Changes to src/pcache1.c.
︙ | ︙ | |||
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | */ static void pcache1TruncateUnsafe( PCache1 *pCache, /* The cache to truncate */ unsigned int iLimit /* Drop pages with this pgno or larger */ ){ TESTONLY( unsigned int nPage = 0; ) /* To assert pCache->nPage is correct */ unsigned int h; assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); for(h=0; h<pCache->nHash; h++){ PgHdr1 **pp = &pCache->apHash[h]; PgHdr1 *pPage; while( (pPage = *pp)!=0 ){ if( pPage->iKey>=iLimit ){ pCache->nPage--; *pp = pPage->pNext; if( !pPage->isPinned ) pcache1PinPage(pPage); pcache1FreePage(pPage); }else{ pp = &pPage->pNext; TESTONLY( nPage++; ) } } } assert( pCache->nPage==nPage ); } /******************************************************************************/ /******** sqlite3_pcache Methods **********************************************/ /* ** Implementation of the sqlite3_pcache.xInit method. | > > > > > > > | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | */ static void pcache1TruncateUnsafe( PCache1 *pCache, /* The cache to truncate */ unsigned int iLimit /* Drop pages with this pgno or larger */ ){ TESTONLY( unsigned int nPage = 0; ) /* To assert pCache->nPage is correct */ unsigned int h; START_DEBUG_TIMER; int nFree = 0; assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); for(h=0; h<pCache->nHash; h++){ PgHdr1 **pp = &pCache->apHash[h]; PgHdr1 *pPage; while( (pPage = *pp)!=0 ){ if( pPage->iKey>=iLimit ){ pCache->nPage--; nFree++; *pp = pPage->pNext; if( !pPage->isPinned ) pcache1PinPage(pPage); pcache1FreePage(pPage); }else{ pp = &pPage->pNext; TESTONLY( nPage++; ) } } } assert( pCache->nPage==nPage ); END_DEBUG_TIMER( DEBUG_TIMER_BIG_TIMEOUT ){ sqlite3_log(SQLITE_NOTICE, "slow pcache1TruncateUnsafe() %lld nFree=%d", iDebugTimer, nFree); } } /******************************************************************************/ /******** sqlite3_pcache Methods **********************************************/ /* ** Implementation of the sqlite3_pcache.xInit method. |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
3825 3826 3827 3828 3829 3830 3831 | #define END_DEBUG_TIMER(nDebugUsec) \ gettimeofday(&debug_timer_var, 0); \ iDebugTimer = 1000000*(sqlite3_uint64)debug_timer_var.tv_sec \ +debug_timer_var.tv_usec-iDebugTimerStart; \ if( iDebugTimer>=nDebugUsec ) | | | > > | > | 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 | #define END_DEBUG_TIMER(nDebugUsec) \ gettimeofday(&debug_timer_var, 0); \ iDebugTimer = 1000000*(sqlite3_uint64)debug_timer_var.tv_sec \ +debug_timer_var.tv_usec-iDebugTimerStart; \ if( iDebugTimer>=nDebugUsec ) #ifndef DEBUG_TIMER_BIG_TIMEOUT # define DEBUG_TIMER_BIG_TIMEOUT 10000 #endif #ifndef DEBUG_TIMER_SMALL_TIMEOUT # define DEBUG_TIMER_SMALL_TIMEOUT 1000 #endif #endif /* _SQLITEINT_H_ */ |