0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00
mongodb/util/goodies.h
2007-11-05 14:44:26 -05:00

35 lines
663 B
C++

// goodies.h
// miscellaneous junk
#pragma once
#include "../stdafx.h"
inline void dumpmemory(const char *data, int len) {
try {
const char *q = data;
const char *p = q;
while( len > 0 ) {
for( int i = 0; i < 16; i++ ) {
cout << (*p >= 32 && *p <= 126) ? *p : '.';
p++;
}
cout << " ";
for( int i = 0; i < 16; i++ )
cout << (unsigned) *p << ' ';
cout << endl;
len -= 16;
}
} catch(...) { }
}
#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
inline void sleepsecs(int s) {
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC);
xt.sec += s;
boost::thread::sleep(xt);
}