MCPcopy Create free account
hub / github.com/apache/mesos / TEST_P

Function TEST_P

3rdparty/libprocess/src/tests/benchmarks.cpp:790–839  ·  view source on GitHub ↗

Tests the performance of metrics fetching when there are a large number of metrics.

Source from the content-addressed store, hash-verified

788// Tests the performance of metrics fetching when there
789// are a large number of metrics.
790TEST_P(Metrics_BENCHMARK_Test, Scalability)
791{
792 size_t metrics_count = GetParam();
793
794 vector<metrics::Counter> counters;
795 counters.reserve(metrics_count);
796
797 for (size_t i = 0; i < metrics_count; ++i) {
798 counters.push_back(
799 metrics::Counter("metrics/keys/can/be/somewhat/long/"
800 "so/we/use/a/fairly/long/key/here/"
801 "to/test/a/more/pathological/case/" +
802 stringify(i)));
803 }
804
805 Stopwatch watch;
806 watch.start();
807 for (size_t i = 0; i < metrics_count; ++i) {
808 metrics::add(counters[i]).get();
809 }
810 watch.stop();
811
812 std::cout << "Added " << metrics_count << " counters in "
813 << watch.elapsed() << std::endl;
814
815 watch.start();
816 metrics::snapshot(None()).get();
817 watch.stop();
818
819 std::cout << "Snapshot of " << metrics_count << " counters in "
820 << watch.elapsed() << std::endl;
821
822 UPID upid("metrics", process::address());
823
824 watch.start();
825 http::get(upid, "snapshot").get();
826 watch.stop();
827
828 std::cout << "HTTP /snapshot of " << metrics_count << " counters in "
829 << watch.elapsed() << std::endl;
830
831 watch.start();
832 for (size_t i = 0; i < metrics_count; ++i) {
833 metrics::remove(counters[i]).get();
834 }
835 watch.stop();
836
837 std::cout << "Removed " << metrics_count << " counters in "
838 << watch.elapsed() << std::endl;
839}
840
841
842TEST(ProcessTest, Process_BENCHMARK_MpscLinkedQueueEmpty)

Callers

nothing calls this directly

Calls 13

snapshotFunction · 0.85
NoneClass · 0.85
elapsedMethod · 0.80
startMethod · 0.65
stopMethod · 0.65
CounterClass · 0.50
stringifyClass · 0.50
addFunction · 0.50
addressFunction · 0.50
getFunction · 0.50
removeFunction · 0.50
reserveMethod · 0.45

Tested by

no test coverage detected