本文整理汇总了C#中BrightstarProfiler.Incr方法的典型用法代码示例。如果您正苦于以下问题:C# BrightstarProfiler.Incr方法的具体用法?C# BrightstarProfiler.Incr怎么用?C# BrightstarProfiler.Incr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrightstarProfiler
的用法示例。
在下文中一共展示了BrightstarProfiler.Incr方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Retrieve
public byte[] Retrieve(ulong pageId, BrightstarProfiler profiler)
{
using (profiler.Step("PageStore.Retrieve"))
{
if (!_readonly && pageId >= _newPageOffset)
{
var newPage = _newPages[(int) (pageId - _newPageOffset)];
return newPage.Data;
}
var page = PageCache.Instance.Lookup(_path, pageId) as FilePage;
if (page != null)
{
profiler.Incr("PageCache Hit");
return page.Data;
}
using (profiler.Step("Load Page"))
{
profiler.Incr("PageCache Miss");
using (profiler.Step("Create FilePage"))
{
// Lock on stream to prevent attempts to concurrently load a page
lock (_stream)
{
page = new FilePage(_stream, pageId, _pageSize);
}
}
using (profiler.Step("Add FilePage To Cache"))
{
PageCache.Instance.InsertOrUpdate(_path, page);
}
return page.Data;
}
}
}
示例2: GetNode
public INode GetNode(ulong nodeId, BrightstarProfiler profiler)
{
using (profiler.Step("BPlusTree.GetNode"))
{
INode ret;
if (_modifiedNodes.TryGetValue(nodeId, out ret))
{
profiler.Incr("NodeCache Hit");
return ret;
}
if (_nodeCache.TryGetValue(nodeId, out ret))
{
profiler.Incr("NodeCache Hit");
return ret;
}
profiler.Incr("NodeCache Miss");
using (profiler.Step("Load Node"))
{
var nodePage = _pageStore.Retrieve(nodeId, profiler);
var header = BitConverter.ToInt32(nodePage, 0);
if (header < 0)
{
ret = new InternalNode(nodeId, nodePage, ~header, _config);
}
else
{
ret = new LeafNode(nodeId, nodePage, header, _config);
}
_nodeCache.Add(ret);
return ret;
}
}
}
示例3: GetNode
public INode GetNode(ulong nodeId, BrightstarProfiler profiler)
{
using (profiler.Step("BPlusTree.GetNode"))
{
INode ret;
if (_nodeCache.TryGetValue(nodeId, out ret))
{
profiler.Incr("NodeCache Hit");
return ret;
}
profiler.Incr("NodeCache Miss");
using (profiler.Step("Load Node"))
{
var nodePage = _pageStore.Retrieve(nodeId, profiler);
var header = BitConverter.ToInt32(nodePage.Data, 0);
if (header < 0)
{
ret = MakeInternalNode(nodePage, ~header);
#if DEBUG_BTREE
_config.BTreeDebug("{0}: Loaded INTERNAL node from page {1}. {2}",_config.DebugId, nodePage.Id, ret.ToString());
#endif
}
else
{
ret = MakeLeafNode(nodePage, header);
#if DEBUG_BTREE
_config.BTreeDebug("{0}: Loaded LEAF node from page {1}. {2}", _config.DebugId, nodePage.Id, ret.ToString());
#endif
}
_nodeCache.Add(ret);
return ret;
}
}
}
示例4: Retrieve
public IPage Retrieve(ulong pageId, BrightstarProfiler profiler)
{
using (profiler.Step("PageStore.Retrieve"))
{
if (!_readonly && pageId >= _newPageOffset)
{
var newPageRef = _newPages[(int) (pageId - _newPageOffset)];
if (newPageRef.IsAlive)
{
var newPage = newPageRef.Target as IPage;
if (newPage != null) return newPage;
}
}
var page = PageCache.Instance.Lookup(_path, pageId) as IPage;
if (page != null)
{
profiler.Incr("PageCache Hit");
return page;
}
using (profiler.Step("Load Page"))
{
profiler.Incr("PageCache Miss");
using (profiler.Step("Create FilePage"))
{
page = new FilePage(_stream, pageId, _pageSize);
#if DEBUG_PAGESTORE
Logging.LogDebug("Load {0} {1}", pageId, BitConverter.ToInt32(page.Data, 0));
#endif
}
using (profiler.Step("Add FilePage To Cache"))
{
PageCache.Instance.InsertOrUpdate(_path, page);
}
return page;
}
}
}
示例5: GetPage
private BinaryFilePage GetPage(ulong pageId, BrightstarProfiler profiler)
{
using (profiler.Step("PageStore.GetPage"))
{
lock (_pageCacheLock)
{
BinaryFilePage page;
Tuple<BinaryFilePage, ulong> modifiedPage;
if (_modifiedPages.TryGetValue(pageId, out modifiedPage))
{
profiler.Incr("PageCache Hit");
return modifiedPage.Item1;
}
page = PageCache.Instance.Lookup(_filePath, pageId) as BinaryFilePage;
if (page != null)
{
profiler.Incr("PageCache Hit");
return page;
}
using (profiler.Step("Load Page"))
{
profiler.Incr("PageCache Miss");
page = new BinaryFilePage(_inputStream, pageId, _nominalPageSize);
PageCache.Instance.InsertOrUpdate(_filePath, page);
}
return page;
}
}
}
示例6: Retrieve
public IPage Retrieve(ulong pageId, BrightstarProfiler profiler)
{
using (profiler.Step("PageStore.Retrieve"))
{
if (!_readonly && pageId >= _newPageOffset)
{
var newPageRef = _newPages[(int) (pageId - _newPageOffset)];
if (newPageRef.IsAlive)
{
var newPage = newPageRef.Target as IPage;
if (newPage != null) return newPage;
}
}
var page = PageCache.Instance.Lookup(_path, pageId) as IPage;
if (page != null)
{
profiler.Incr("PageCache Hit");
return page;
}
if (_backgroundPageWriter != null)
{
// See if the page is currently queued for background write
if (_backgroundPageWriter.TryGetPage(pageId, out page))
{
profiler.Incr("BackgroundWriter Queue Hit");
return page;
}
}
using (profiler.Step("Load Page"))
{
profiler.Incr("PageCache Miss");
using (profiler.Step("Create FilePage"))
{
page = new FilePage(_stream, pageId, _pageSize);
if (_backgroundPageWriter != null)
{
_backgroundPageWriter.ResetTimestamp(pageId);
}
#if DEBUG_PAGESTORE
Logging.LogDebug("Load {0} {1}", pageId, BitConverter.ToInt32(page.Data, 0));
#endif
}
using (profiler.Step("Add FilePage To Cache"))
{
PageCache.Instance.InsertOrUpdate(_path, page);
}
return page;
}
}
}
示例7: Retrieve
public IPage Retrieve(ulong pageId, BrightstarProfiler profiler)
{
using (profiler.Step("BinaryFilePageStore.GetPage"))
{
// Look in the page cache
IPage page = PageCache.Instance.Lookup(_partitionId, pageId) as BinaryFilePage;
if (page != null)
{
profiler.Incr("PageCache Hit");
return page;
}
// See if the page is queued for writing
if (_backgroundPageWriter != null && _backgroundPageWriter.TryGetPage(pageId, out page))
{
profiler.Incr("BackgroundWriter Queue Hit");
return page;
}
// Not found in memory, so go to the disk
profiler.Incr("PageCache Miss");
using (profiler.Step("Load Page"))
{
page = _modifiedPages.ContainsKey(pageId)
? new BinaryFilePage(_inputStream, pageId, _nominalPageSize, _writeTxnId, true)
: new BinaryFilePage(_inputStream, pageId, _nominalPageSize, _readTxnId, false);
PageCache.Instance.InsertOrUpdate(_partitionId, page);
return page;
}
}
}