📄 gistfcnt.h
字号:
// -*- Mode: C++ -*-//--------------------------------------------------------------------// GiSTfcnt.h// ----------//// GiST - Generalized Search Tree // June 2001 release, Aalborg University// // This file is a revised version of a part of the original // libGiST release (version 0.9beta1) // Copyright (c) 1996, Regents of the University of California//#ifndef GISTFCNT_H#define GISTFCNT_H#define CACHE_INC (100)#define DEF_BUFFER_SIZE (100)#include "GiSTpath.h"#include "GiSTfileCache.h"//--------------------------------------------------------------------// GiSTcache - stores the numbers and dirty flags of the pages// in the simulated cache buffer//class GiSTcache{public: GiSTcache(int size); ~GiSTcache(); void UpdateSize (int size); int GetSize () { return len; } int Add(int x, char dirty); int Find(int x) const; int FlushDirty(); void Clear() {num = 0;}private: char* dirtyFlags; int* array; int num; int len;};//--------------------------------------------------------------------// GiSTfileCnt - augments GiSTfileCache to count accessed disk pages// and simulates the cache buffer of the desired side // (GiSTfileCahce caches real pages to improve the// perfofmance of the experimental testbench itself)//class GiSTfileCnt : public GiSTfileCache{public: GiSTfileCnt() : GiSTfileCache(), pcount(0), pageSize(DefPageSize) { cache = new GiSTcache(DEF_BUFFER_SIZE); } ~GiSTfileCnt() { delete cache; } static int DefPageSize; void ResetCounter(); void Write (GiSTpage page, const char *buf); void Read (GiSTpage page, char *buf); void DontCountLastOp() { --pcount; } int GetCounter(); int PageSize () const { return pageSize; } void SetBufferSize (int size) { cache->UpdateSize(size); } int GetBufferSize () const { return cache->GetSize(); } private: int pageSize; int pcount; GiSTcache* cache;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -