00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "fennel/common/CommonPreamble.h"
00025 #include "fennel/segment/TracingSegment.h"
00026 #include "fennel/cache/CachePage.h"
00027
00028 FENNEL_BEGIN_CPPFILE("$Id: //open/dev/fennel/segment/TracingSegment.cpp#11 $");
00029
00030
00031
00032
00033
00034 TracingSegment::TracingSegment(
00035 SharedSegment pDelegateSegment,
00036 SharedTraceTarget pTraceTarget,
00037 std::string sourceName)
00038 : DelegatingSegment(pDelegateSegment),
00039 TraceSource(pTraceTarget,sourceName)
00040 {
00041 FENNEL_TRACE(TRACE_FINE,"constructor");
00042 }
00043
00044 TracingSegment::~TracingSegment()
00045 {
00046 FENNEL_TRACE(TRACE_FINE,"destructor");
00047 }
00048
00049 void TracingSegment::setPageSuccessor(PageId pageId, PageId successorId)
00050 {
00051 FENNEL_TRACE(
00052 TRACE_FINER,
00053 "setPageSuccessor of PageId " << std::hex << pageId
00054 << " to PageId " << std::hex << successorId);
00055 DelegatingSegment::setPageSuccessor(pageId,successorId);
00056 }
00057
00058 BlockId TracingSegment::translatePageId(PageId pageId)
00059 {
00060 BlockId blockId = DelegatingSegment::translatePageId(pageId);
00061 FENNEL_TRACE(
00062 TRACE_FINEST,
00063 "translatePageId " << std::hex << pageId << " returns BlockId "
00064 << std::hex << blockId);
00065 return blockId;
00066 }
00067
00068 PageId TracingSegment::translateBlockId(BlockId blockId)
00069 {
00070 PageId pageId = DelegatingSegment::translateBlockId(blockId);
00071 FENNEL_TRACE(
00072 TRACE_FINEST,
00073 "translateBlockId " << std::hex << blockId << " returns PageId "
00074 << std::hex << pageId);
00075 return pageId;
00076 }
00077
00078 PageId TracingSegment::allocatePageId(PageOwnerId ownerId)
00079 {
00080 PageId pageId = DelegatingSegment::allocatePageId(ownerId);
00081 FENNEL_TRACE(
00082 TRACE_FINE,
00083 "allocatePageId for PageOwnerId " << std::hex << ownerId
00084 << " returns PageId " << std::hex << pageId);
00085 return pageId;
00086 }
00087
00088 bool TracingSegment::ensureAllocatedSize(BlockNum nPages)
00089 {
00090 bool b = DelegatingSegment::ensureAllocatedSize(nPages);
00091 FENNEL_TRACE(
00092 TRACE_FINE,
00093 "ensureAllocatedSize of " << nPages << " pages"
00094 << " returns " << b);
00095 return b;
00096 }
00097
00098 void TracingSegment::deallocatePageRange(PageId startPageId,PageId endPageId)
00099 {
00100 FENNEL_TRACE(
00101 TRACE_FINE,
00102 "deallocatePageRange " << std::hex << startPageId << ", "
00103 << std::hex << endPageId);
00104 DelegatingSegment::deallocatePageRange(startPageId,endPageId);
00105 }
00106
00107 void TracingSegment::notifyPageMap(CachePage &page)
00108 {
00109 FENNEL_TRACE(
00110 TRACE_FINEST,
00111 "notifyPageMap @" << &page << " BlockId "
00112 << std::hex << page.getBlockId());
00113 DelegatingSegment::notifyPageMap(page);
00114 }
00115
00116 void TracingSegment::notifyPageUnmap(CachePage &page)
00117 {
00118 FENNEL_TRACE(
00119 TRACE_FINEST,
00120 "notifyPageUnmap @" << &page << " BlockId "
00121 << std::hex << page.getBlockId());
00122 DelegatingSegment::notifyPageUnmap(page);
00123 }
00124
00125 void TracingSegment::notifyAfterPageRead(CachePage &page)
00126 {
00127 FENNEL_TRACE(
00128 TRACE_FINEST,
00129 "notifyAfterPageRead @" << &page << " BlockId "
00130 << std::hex << page.getBlockId());
00131 DelegatingSegment::notifyAfterPageRead(page);
00132 }
00133
00134 void TracingSegment::notifyPageDirty(CachePage &page,bool bDataValid)
00135 {
00136 FENNEL_TRACE(
00137 TRACE_FINER,
00138 "notifyPageDirty @" << &page << " BlockId "
00139 << std::hex << page.getBlockId());
00140 DelegatingSegment::notifyPageDirty(page,bDataValid);
00141 }
00142
00143 void TracingSegment::notifyBeforePageFlush(CachePage &page)
00144 {
00145 FENNEL_TRACE(
00146 TRACE_FINER,
00147 "notifyBeforePageFlush @" << &page << " BlockId "
00148 << std::hex << page.getBlockId());
00149 DelegatingSegment::notifyBeforePageFlush(page);
00150 }
00151
00152 void TracingSegment::notifyAfterPageFlush(CachePage &page)
00153 {
00154 FENNEL_TRACE(
00155 TRACE_FINER,
00156 "notifyAfterPageFlush @" << &page << " BlockId "
00157 << std::hex << page.getBlockId());
00158 DelegatingSegment::notifyAfterPageFlush(page);
00159 }
00160
00161 void TracingSegment::delegatedCheckpoint(
00162 Segment &delegatingSegment,
00163 CheckpointType checkpointType)
00164 {
00165 FENNEL_TRACE(
00166 TRACE_FINER,
00167 "checkpoint type=" << checkpointType);
00168 DelegatingSegment::delegatedCheckpoint(delegatingSegment,checkpointType);
00169 }
00170
00171 MappedPageListener *TracingSegment::getMappedPageListener(BlockId blockId)
00172 {
00173
00174
00175
00176 MappedPageListener *pListener =
00177 getDelegateSegment()->getMappedPageListener(blockId);
00178 FENNEL_TRACE(
00179 TRACE_FINEST,
00180 "getMappedPageListener for blockId " << std::hex << blockId
00181 << " = " << std::hex << pListener);
00182
00183 return pListener->getTracingListener();
00184 }
00185
00186 MappedPageListener *TracingSegment::notifyAfterPageCheckpointFlush(
00187 CachePage &page)
00188 {
00189
00190
00191
00192 MappedPageListener *pListener =
00193 getDelegateSegment()->notifyAfterPageCheckpointFlush(page);
00194 if (pListener == NULL) {
00195 FENNEL_TRACE(
00196 TRACE_FINER,
00197 "notifyAfterPageCheckpointFlush for blockId " << std::hex <<
00198 page.getBlockId() << " = NULL");
00199 return pListener;
00200 } else {
00201 FENNEL_TRACE(
00202 TRACE_FINER,
00203 "notifyAfterPageCheckpointFlush for blockId " << std::hex <<
00204 page.getBlockId() << " = " << std::hex << pListener);
00205 return pListener->getTracingListener();
00206 }
00207 }
00208
00209 bool TracingSegment::isWriteVersioned()
00210 {
00211 bool b = getDelegateSegment()->isWriteVersioned();
00212 FENNEL_TRACE(TRACE_FINEST,"isWriteVersioned returns " << b);
00213 return b;
00214 }
00215
00216 FENNEL_END_CPPFILE("$Id: //open/dev/fennel/segment/TracingSegment.cpp#11 $");
00217
00218