1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 // -*- c++ -*- 19 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 20 21 // O S C L _ F I L E _ STATS 22 23 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 24 25 /*! \addtogroup osclio OSCL IO 26 * 27 * @{ 28 */ 29 30 31 /*! \file oscl_file_stats.h 32 \brief File stats class 33 34 */ 35 36 #ifndef OSCL_FILE_STATS_H_INCLUDED 37 #define OSCL_FILE_STATS_H_INCLUDED 38 39 #include "oscl_base.h" 40 #include "osclconfig_io.h" 41 42 #define OSCL_FILE_STATS_LOGGER_NODE "OsclFileStats" 43 44 class OsclFileStatsItem 45 { 46 public: 47 uint32 iOpCount; 48 uint32 iParam; 49 TOsclFileOffset iParam2; 50 uint32 iStartTick; 51 uint32 iTotalTicks; 52 }; 53 54 enum TOsclFileOp 55 { 56 EOsclFileOp_Open 57 , EOsclFileOp_Close 58 , EOsclFileOp_Read 59 , EOsclFileOp_Write 60 , EOsclFileOp_Seek 61 , EOsclFileOp_Tell 62 , EOsclFileOp_Size 63 , EOsclFileOp_Flush 64 , EOsclFileOp_EndOfFile 65 , EOsclFileOp_NativeOpen 66 , EOsclFileOp_NativeClose 67 , EOsclFileOp_NativeRead 68 , EOsclFileOp_NativeWrite 69 , EOsclFileOp_NativeSeek 70 , EOsclFileOp_NativeTell 71 , EOsclFileOp_NativeSize 72 , EOsclFileOp_NativeFlush 73 , EOsclFileOp_NativeEndOfFile 74 , EOsclFileOp_Last 75 }; 76 static const char* const TOsclFileOpStr[] = 77 { 78 "Open" 79 , "Close" 80 , "Read" 81 , "Write" 82 , "Seek" 83 , "Tell" 84 , "Size" 85 , "Flush" 86 , "EndOfFile" 87 , "NativeOpen" 88 , "NativeClose" 89 , "NativeRead" 90 , "NativeWrite" 91 , "NativeSeek" 92 , "NativeTell" 93 , "NativeSize" 94 , "NativeFlush" 95 , "NativeEndOfFile" 96 , "???" 97 }; 98 99 class PVLogger; 100 class Oscl_File; 101 102 class OsclFileStats 103 { 104 public: 105 OsclFileStats(Oscl_File* c); 106 void Start(uint32& aTicks); 107 void End(TOsclFileOp aOp, uint32 aStart, uint32 aParam = 0, TOsclFileOffset aParam2 = 0); 108 void Log(TOsclFileOp, PVLogger*, uint32); 109 void LogAll(PVLogger*, uint32); 110 111 private: 112 Oscl_File* iContainer; 113 //fixed array of the max time per item. 114 OsclFileStatsItem iStats[EOsclFileOp_Last]; 115 }; 116 117 118 119 #endif 120 121 /*! @} */ 122 123