logger: fixes

This commit is contained in:
Sage Weil 2009-02-26 14:48:40 -08:00
parent 61dd86d97e
commit 48533a5c2d
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ class LogType {
public:
LogType(int first, int tail) :
first_key(first), num_keys(tail-first),
first_key(first), num_keys(tail-first - 1),
key_name(num_keys), inc_keys(num_keys), avg_keys(num_keys) {
for (int i=0; i<num_keys; i++) {
key_name[i] = 0;
@ -40,7 +40,7 @@ class LogType {
}
}
int lookup_key(int key, bool isnew=false) {
int i = key - first_key;
int i = key - first_key - 1;
assert(i >= 0 && i < num_keys);
assert(isnew || key_name[i]);
return i;

View File

@ -165,9 +165,9 @@ void Logger::_flush()
if (wrote_header_last > 10) {
out << "#" << type->num_keys;
for (int i=0; i<type->num_keys; i++) {
out << "\t" << type->key_name[i];
out << "\t" << (type->key_name[i] ? type->key_name[i] : "???");
if (type->avg_keys[i])
out << "\t" << type->key_name[i] << "*\t" << type->key_name[i] << "~";
out << "\t(n)\t(var)";
}
out << std::endl; //out << "\t (" << type->keymap.size() << ")" << endl;
wrote_header_last = 0;