Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: third_party/sqlite/src/src/status.c

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/src/sqliteLimit.h ('k') | third_party/sqlite/src/src/table.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ** 2008 June 18 2 ** 2008 June 18
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 *pCurrent = wsdStat.nowValue[op]; 151 *pCurrent = wsdStat.nowValue[op];
152 *pHighwater = wsdStat.mxValue[op]; 152 *pHighwater = wsdStat.mxValue[op];
153 if( resetFlag ){ 153 if( resetFlag ){
154 wsdStat.mxValue[op] = wsdStat.nowValue[op]; 154 wsdStat.mxValue[op] = wsdStat.nowValue[op];
155 } 155 }
156 sqlite3_mutex_leave(pMutex); 156 sqlite3_mutex_leave(pMutex);
157 (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */ 157 (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */
158 return SQLITE_OK; 158 return SQLITE_OK;
159 } 159 }
160 int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ 160 int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
161 sqlite3_int64 iCur, iHwtr; 161 sqlite3_int64 iCur = 0, iHwtr = 0;
162 int rc; 162 int rc;
163 #ifdef SQLITE_ENABLE_API_ARMOR 163 #ifdef SQLITE_ENABLE_API_ARMOR
164 if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT; 164 if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
165 #endif 165 #endif
166 rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag); 166 rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag);
167 if( rc==0 ){ 167 if( rc==0 ){
168 *pCurrent = (int)iCur; 168 *pCurrent = (int)iCur;
169 *pHighwater = (int)iHwtr; 169 *pHighwater = (int)iHwtr;
170 } 170 }
171 return rc; 171 return rc;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0; 212 db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0;
213 } 213 }
214 break; 214 break;
215 } 215 }
216 216
217 /* 217 /*
218 ** Return an approximation for the amount of memory currently used 218 ** Return an approximation for the amount of memory currently used
219 ** by all pagers associated with the given database connection. The 219 ** by all pagers associated with the given database connection. The
220 ** highwater mark is meaningless and is returned as zero. 220 ** highwater mark is meaningless and is returned as zero.
221 */ 221 */
222 case SQLITE_DBSTATUS_CACHE_USED_SHARED:
222 case SQLITE_DBSTATUS_CACHE_USED: { 223 case SQLITE_DBSTATUS_CACHE_USED: {
223 int totalUsed = 0; 224 int totalUsed = 0;
224 int i; 225 int i;
225 sqlite3BtreeEnterAll(db); 226 sqlite3BtreeEnterAll(db);
226 for(i=0; i<db->nDb; i++){ 227 for(i=0; i<db->nDb; i++){
227 Btree *pBt = db->aDb[i].pBt; 228 Btree *pBt = db->aDb[i].pBt;
228 if( pBt ){ 229 if( pBt ){
229 Pager *pPager = sqlite3BtreePager(pBt); 230 Pager *pPager = sqlite3BtreePager(pBt);
230 totalUsed += sqlite3PagerMemUsed(pPager); 231 int nByte = sqlite3PagerMemUsed(pPager);
232 if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){
233 nByte = nByte / sqlite3BtreeConnectionCount(pBt);
234 }
235 totalUsed += nByte;
231 } 236 }
232 } 237 }
233 sqlite3BtreeLeaveAll(db); 238 sqlite3BtreeLeaveAll(db);
234 *pCurrent = totalUsed; 239 *pCurrent = totalUsed;
235 *pHighwater = 0; 240 *pHighwater = 0;
236 break; 241 break;
237 } 242 }
238 243
239 /* 244 /*
240 ** *pCurrent gets an accurate estimate of the amount of memory used 245 ** *pCurrent gets an accurate estimate of the amount of memory used
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 break; 342 break;
338 } 343 }
339 344
340 default: { 345 default: {
341 rc = SQLITE_ERROR; 346 rc = SQLITE_ERROR;
342 } 347 }
343 } 348 }
344 sqlite3_mutex_leave(db->mutex); 349 sqlite3_mutex_leave(db->mutex);
345 return rc; 350 return rc;
346 } 351 }
OLDNEW
« no previous file with comments | « third_party/sqlite/src/src/sqliteLimit.h ('k') | third_party/sqlite/src/src/table.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698