330 // - iCallCounter - how many times the monitored OS porting layer function has been called; |
330 // - iCallCounter - how many times the monitored OS porting layer function has been called; |
331 // - iTicksTotal - the total amount of time in ticks spent in the monitored OS porting layer function; |
331 // - iTicksTotal - the total amount of time in ticks spent in the monitored OS porting layer function; |
332 // - iBytesTotal - the total amount of bytes passed to the monitored OS porting layer function (if it is read or write); |
332 // - iBytesTotal - the total amount of bytes passed to the monitored OS porting layer function (if it is read or write); |
333 struct TOsCallProfile |
333 struct TOsCallProfile |
334 { |
334 { |
335 TOsCallProfile(char aType, char aIdentifier[]) : |
335 TOsCallProfile(char aType, const TDesC& aIdentifier) : |
336 iType(aType), |
336 iType(aType), |
|
337 iIdentifier(aIdentifier), |
337 iCallCounter(0), |
338 iCallCounter(0), |
338 iTicksTotal(0), |
339 iTicksTotal(0), |
339 iBytesTotal(0) |
340 iBytesTotal(0) |
340 { |
341 { |
341 iIdentifier[0] = aIdentifier[0]; |
|
342 iIdentifier[1] = aIdentifier[1]; |
|
343 } |
342 } |
344 void Zero() |
343 void Zero() |
345 { |
344 { |
346 iCallCounter = 0; |
345 iCallCounter = 0; |
347 iTicksTotal = 0; |
346 iTicksTotal = 0; |
348 iBytesTotal = 0; |
347 iBytesTotal = 0; |
349 } |
348 } |
350 char iType; |
349 char iType; |
351 char iIdentifier[2]; |
350 TBuf<32> iIdentifier; |
352 TInt iCallCounter; |
351 TInt iCallCounter; |
353 TInt64 iTicksTotal; |
352 TInt64 iTicksTotal; |
354 TInt64 iBytesTotal; |
353 TInt64 iBytesTotal; |
355 }; |
354 }; |
356 |
355 |
357 //An array of TOsCallProfile entries, each entry keeps the profile of a specifc OS porting layer function, when |
356 //An array of TOsCallProfile entries, each entry keeps the profile of a specifc OS porting layer function, when |
358 //the function was used on the main database file |
357 //the function was used on the main database file |
359 TOsCallProfile TheOsCallMProfile[EOsOpLast] = |
358 TOsCallProfile TheOsCallMProfile[EOsOpLast] = |
360 { |
359 { |
361 TOsCallProfile('M', "CL"), TOsCallProfile('M', "RD"), TOsCallProfile('M', "WR"), TOsCallProfile('M', "TR"), |
360 TOsCallProfile('M', _L("Close")), TOsCallProfile('M', _L("Read")), TOsCallProfile('M', _L("Write")), TOsCallProfile('M', _L("Truncate")), |
362 TOsCallProfile('M', "SY"), TOsCallProfile('M', "FS"), TOsCallProfile('M', "LK"), TOsCallProfile('M', "UL"), |
361 TOsCallProfile('M', _L("Sync")), TOsCallProfile('M', _L("Size")), TOsCallProfile('M', _L("Lock")), TOsCallProfile('M', _L("Unlock")), |
363 TOsCallProfile('M', "RL"), TOsCallProfile('M', "FC"), TOsCallProfile('M', "SS"), TOsCallProfile('M', "DC"), |
362 TOsCallProfile('M', _L("CheckReservedLock")), TOsCallProfile('M', _L("FileControl")), TOsCallProfile('M', _L("SetSize")), TOsCallProfile('M', _L("DeviceCharacteristics")), |
364 TOsCallProfile('M', "OP"), TOsCallProfile('M', "DE"), TOsCallProfile('M', "AC"), TOsCallProfile('M', "FN"), |
363 TOsCallProfile('M', _L("Open")), TOsCallProfile('M', _L("Delete")), TOsCallProfile('M', _L("Access")), TOsCallProfile('M', _L("FullPath")), |
365 TOsCallProfile('M', "RN"), TOsCallProfile('M', "SL"), TOsCallProfile('M', "CT"), TOsCallProfile('M', "LE") |
364 TOsCallProfile('M', _L("Randomness")), TOsCallProfile('M', _L("Sleep")), TOsCallProfile('M', _L("CurrentTime")), TOsCallProfile('M', _L("GetLastError")) |
366 }; |
365 }; |
367 |
366 |
368 //An array of TOsCallProfile entries, each entry keeps the profile of a specifc OS porting layer function, when |
367 //An array of TOsCallProfile entries, each entry keeps the profile of a specifc OS porting layer function, when |
369 //the function was used on the journal file |
368 //the function was used on the journal file |
370 TOsCallProfile TheOsCallJProfile[EOsOpLast] = |
369 TOsCallProfile TheOsCallJProfile[EOsOpLast] = |
371 { |
370 { |
372 TOsCallProfile('J', "CL"), TOsCallProfile('J', "RD"), TOsCallProfile('J', "WR"), TOsCallProfile('J', "TR"), |
371 TOsCallProfile('J', _L("Close")), TOsCallProfile('J', _L("Read")), TOsCallProfile('J', _L("Write")), TOsCallProfile('J', _L("Truncate")), |
373 TOsCallProfile('J', "SY"), TOsCallProfile('J', "FS"), TOsCallProfile('J', "LK"), TOsCallProfile('J', "UL"), |
372 TOsCallProfile('J', _L("Sync")), TOsCallProfile('J', _L("Size")), TOsCallProfile('J', _L("Lock")), TOsCallProfile('J', _L("Unlock")), |
374 TOsCallProfile('J', "RL"), TOsCallProfile('J', "FC"), TOsCallProfile('J', "SS"), TOsCallProfile('J', "DC"), |
373 TOsCallProfile('J', _L("CheckReservedLock")), TOsCallProfile('J', _L("FileControl")), TOsCallProfile('J', _L("SetSize")), TOsCallProfile('J', _L("DeviceCharacteristics")), |
375 TOsCallProfile('J', "OP"), TOsCallProfile('J', "DE"), TOsCallProfile('J', "AC"), TOsCallProfile('J', "FN"), |
374 TOsCallProfile('J', _L("Open")), TOsCallProfile('J', _L("Delete")), TOsCallProfile('J', _L("Access")), TOsCallProfile('J', _L("FullPath")), |
376 TOsCallProfile('J', "RN"), TOsCallProfile('J', "SL"), TOsCallProfile('J', "CT"), TOsCallProfile('J', "LE") |
375 TOsCallProfile('J', _L("Randomness")), TOsCallProfile('J', _L("Sleep")), TOsCallProfile('J', _L("CurrentTime")), TOsCallProfile('J', _L("GetLastError")) |
377 }; |
376 }; |
378 |
377 |
379 //The main class for the OS porting layer call profiles. |
378 //The main class for the OS porting layer call profiles. |
380 class TOsCallCounter |
379 class TOsCallCounter |
381 { |
380 { |
419 if(iOptional) |
418 if(iOptional) |
420 { |
419 { |
421 TPtrC8 fn8(iOptional); |
420 TPtrC8 fn8(iOptional); |
422 fname.Copy(fn8); |
421 fname.Copy(fn8); |
423 } |
422 } |
424 // 0 1 2 3 4 5 6 7 8 9 10 11 |
423 // 0 1 2 3 4 5 6 7 8 9 10 |
425 RDebug::Print(_L("[SQL-OS]¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬\"%X\"¬%c¬%c%c¬%d¬%d¬%ld¬%d¬%ld¬%ld¬%ld¬%S\n"), |
424 RDebug::Print(_L("[SQL-OS]¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬\"%X\"¬%c¬%S¬%d¬%d¬%ld¬%d¬%ld¬%ld¬%ld¬%S\n"), |
426 //[SQL-OS] |
425 //[SQL-OS] |
427 //Handle |
426 //Handle |
428 //Time from start, microseconds |
427 //Time from start, microseconds |
429 //Subtype |
428 //Subtype |
430 //IPC sequence counter |
429 //IPC sequence counter |
431 //IPC call name |
430 //IPC call name |
432 iHandle, //sqlite3_file* |
431 iHandle, //sqlite3_file* |
433 iOsCallProfileRef.iType, //1 - main or journal file |
432 iOsCallProfileRef.iType, //1 - main or journal file |
434 iOsCallProfileRef.iIdentifier[0], //2 - 1st letter - operation type |
433 &iOsCallProfileRef.iIdentifier, //2 - operation type |
435 iOsCallProfileRef.iIdentifier[1], //3 - 2nd letter - operation type |
434 TheOpCounter, //3 - Operation counter |
436 TheOpCounter, //4 - Operation counter |
435 iOsCallProfileRef.iCallCounter, //4 - This call type counter |
437 iOsCallProfileRef.iCallCounter, //5 - This call type counter |
436 iOffset, //5 - File offset |
438 iOffset, //6 - File offset |
437 iBytes, //6 - Data, bytes |
439 iBytes, //7 - Data, bytes |
438 diffTicks, //7 - Ticks |
440 diffTicks, //8 - Ticks |
439 iOsCallProfileRef.iBytesTotal, //8 - Data total, bytes |
441 iOsCallProfileRef.iBytesTotal, //9 - Data total, bytes |
440 iOsCallProfileRef.iTicksTotal, //9 - Ticks total |
442 iOsCallProfileRef.iTicksTotal, //10- Ticks total |
441 &fname); //10- File name |
443 &fname); //11- File name |
|
444 } |
442 } |
445 } |
443 } |
446 } |
444 } |
447 private: |
445 private: |
448 TInt64& iOsCallTicksEntryRef; |
446 TInt64& iOsCallTicksEntryRef; |