1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2011 New Dream Network
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
17 #include <gperftools/profiler.h>
19 #include "common/LogClient.h"
20 #include "perfglue/cpu_profiler.h"
22 void cpu_profiler_handle_command(const std::vector<std::string> &cmd,
25 if (cmd[1] == "status") {
27 ProfilerGetCurrentState(&st);
28 out << "cpu_profiler " << (st.enabled ? "enabled":"not enabled")
29 << " start_time " << st.start_time
30 << " profile_name " << st.profile_name
31 << " samples " << st.samples_gathered;
33 else if (cmd[1] == "flush") {
35 out << "cpu_profiler: flushed";
38 out << "cpu_profiler: unrecognized command " << cmd
39 << "; expected one of status, flush.";