1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "include/types.h"
5 #include "common/Thread.h"
6 #include "common/debug.h"
7 #include "common/Clock.h"
8 #include "common/config.h"
9 #include "common/ceph_argparse.h"
10 #include "global/global_init.h"
12 #define dout_context g_ceph_context
14 struct T : public Thread {
17 map<int,string> mymap;
18 explicit T(int n) : num(n) {
25 void *entry() override {
27 generic_dout(0) << "this is a typical log line. set "
28 << myset << " and map " << mymap << dendl;
33 int main(int argc, const char **argv)
35 int threads = atoi(argv[1]);
36 int num = atoi(argv[2]);
38 cout << threads << " threads, " << num << " lines per thread" << std::endl;
40 vector<const char*> args;
41 argv_to_vec(argc, argv, args);
44 auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_OSD,
45 CODE_ENVIRONMENT_UTILITY, 0);
47 utime_t start = ceph_clock_now();
50 for (int i=0; i<threads; i++) {
56 for (int i=0; i<threads; i++) {
63 utime_t t = ceph_clock_now();
65 cout << " flushing.. " << t << " so far ..." << std::endl;
67 g_ceph_context->_log->flush();
69 utime_t end = ceph_clock_now();
70 utime_t dur = end - start;
72 cout << dur << std::endl;