*** empty log message ***

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@5 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
sage 2004-06-28 20:12:48 +00:00
parent fa8f4df134
commit 0daa6ab9c2
4 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,60 @@
#ifndef __DECAYCOUNTER_H
#define __DECAYCOUNTER_H
#include <math.h>
class DecayCounter {
protected:
double val; // value
double half_life; // in seconds
double k; // k = ln(.5)/half_life
double last_decay; // time of last decay
public:
DecayCounter(double hl) {
set_halflife(hl);
reset();
}
void set_halflife(double hl) {
half_life = hl;
k = log(.5) / hl;
}
double now() {
// ??
return 1.0;
}
void reset() {
last_decay = 0.0;
val = 0;
}
void decay() {
double now = now();
double el = now - last_decay;
if (el > .1) {
val = val * exp(el * k);
last_decay = now;
}
}
double get() {
decay();
return val;
}
double hit(double v = 1.0) {
decay();
val += v;
return val;
}
};
#end;f

View File

@ -4,8 +4,12 @@
#include <sys/types.h>
#include <ext/hash_set>
#include "dcache.h"
//
class CMDS {
@ -15,7 +19,14 @@ class CMDS {
// cache
DentryCache *dc;
// import/export
hash_set<CInode*> import_list;
hash_set<CInode*> export_list;
// message queues
public:
CMDS(int id, int num) {

15
ceph/include/MDStore.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef __MDSTORE_H
#define __MDSTORE_H
class MDStore {
protected:
public:
};
#endif

View File

@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include <map>
#include <ext/hash_map>
#include "inode.h"
#include "lru.h"