mirror of
https://github.com/ceph/ceph
synced 2024-12-16 16:39:21 +00:00
Perf: used to perf local hardware capacity
This program contains a collection of low-level performance measurements for Ceph, which can be run either individually or altogether. These tests measure performance in a single stand-alone process, not in a cluster with multiple servers. Invoke the program like this: Perf test1 test2 ... test1 and test2 are the names of individual performance measurements to run. If no test names are provided then all of the performance tests are run. Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
This commit is contained in:
parent
8e7dfcd29b
commit
38e60deb5a
@ -30,6 +30,10 @@ ceph_perf_objectstore_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
|
||||
ceph_perf_objectstore_CXXFLAGS = $(UNITTEST_CXXFLAGS)
|
||||
bin_DEBUGPROGRAMS += ceph_perf_objectstore
|
||||
|
||||
ceph_perf_SOURCES = test/perf.cc test/perf_helper.cc
|
||||
ceph_perf_LDADD = $(LIBOS) $(CEPH_GLOBAL)
|
||||
bin_DEBUGPROGRAMS += ceph_perf
|
||||
|
||||
if LINUX
|
||||
ceph_test_objectstore_SOURCES = test/objectstore/store_test.cc
|
||||
ceph_test_objectstore_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
|
||||
|
1009
src/test/perf.cc
Normal file
1009
src/test/perf.cc
Normal file
File diff suppressed because it is too large
Load Diff
51
src/test/perf_helper.cc
Normal file
51
src/test/perf_helper.cc
Normal file
@ -0,0 +1,51 @@
|
||||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
/* Copyright (c) 2011 Facebook
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "include/buffer.h"
|
||||
|
||||
using namespace ceph;
|
||||
|
||||
namespace PerfHelper {
|
||||
|
||||
/// Flush the CPU data cache by reading and writing 100MB of new data.
|
||||
void flush_cache()
|
||||
{
|
||||
int hundredMegs = 100 * 1024 * 1024;
|
||||
volatile char* block = new char[hundredMegs];
|
||||
for (int i = 0; i < hundredMegs; i++)
|
||||
block[i] = 1;
|
||||
delete[] block;
|
||||
}
|
||||
|
||||
/// Used in functionCall().
|
||||
uint64_t plus_one(uint64_t x)
|
||||
{
|
||||
return x + 1;
|
||||
}
|
||||
|
||||
/// Used in throwIntNL.
|
||||
void throw_int()
|
||||
{
|
||||
throw 0;
|
||||
}
|
||||
|
||||
/// Used in throwExceptionNL.
|
||||
void throw_end_of_buffer()
|
||||
{
|
||||
throw buffer::end_of_buffer();
|
||||
}
|
||||
}
|
30
src/test/perf_helper.h
Normal file
30
src/test/perf_helper.h
Normal file
@ -0,0 +1,30 @@
|
||||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
/* Copyright (c) 2011 Facebook
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CEPH_TEST_PERFHELPER_H
|
||||
#define CEPH_TEST_PERFHELPER_H
|
||||
|
||||
namespace PerfHelper {
|
||||
|
||||
void flush_cache();
|
||||
uint64_t plus_one(uint64_t x);
|
||||
void throw_end_of_buffer();
|
||||
void throw_int();
|
||||
|
||||
} // PerfHelper
|
||||
|
||||
#endif // CEPH_TEST_PERFHELPER_H
|
Loading…
Reference in New Issue
Block a user