Simplify QPS Metrics collection
diff --git a/test/cpp/util/metrics_server.h b/test/cpp/util/metrics_server.h
index ce05e0b..b04879c 100644
--- a/test/cpp/util/metrics_server.h
+++ b/test/cpp/util/metrics_server.h
@@ -36,6 +36,7 @@
 #include <map>
 #include <mutex>
 
+#include "grpc/support/time.h"
 #include "src/proto/grpc/testing/metrics.grpc.pb.h"
 #include "src/proto/grpc/testing/metrics.pb.h"
 
@@ -48,10 +49,13 @@
  * Example:
  *    MetricsServiceImpl metricsImpl;
  *    ..
- *    // Create Gauge(s). Note: Gauges can be created even after calling
+ *    // Create QpsGauge(s). Note: QpsGauges can be created even after calling
  *    // 'StartServer'.
- *    Gauge gauge1 = metricsImpl.CreateGauge("foo",is_present);
- *    // gauge1 can now be used anywhere in the program to set values.
+ *    QpsGauge qps_gauge1 = metricsImpl.CreateQpsGauge("foo", is_present);
+ *    // qps_gauge1 can now be used anywhere in the program by first making a
+ *    // one-time call qps_gauge1.Reset() and then calling qps_gauge1.Incr()
+ *    // every time to increment a query counter
+ *
  *    ...
  *    // Create the metrics server
  *    std::unique_ptr<grpc::Server> server = metricsImpl.StartServer(port);
@@ -60,17 +64,24 @@
 namespace grpc {
 namespace testing {
 
-// TODO(sreek): Add support for other types of Gauges like Double, String in
-// future
-class Gauge {
+class QpsGauge {
  public:
-  Gauge(long initial_val);
-  void Set(long new_val);
+  QpsGauge();
+
+  // Initialize the internal timer and reset the query count to 0
+  void Reset();
+
+  // Increment the query count by 1
+  void Incr();
+
+  // Return the current qps (i.e query count divided by the time since this
+  // QpsGauge object created (or Reset() was called))
   long Get();
 
  private:
-  long val_;
-  std::mutex val_mu_;
+  gpr_timespec start_time_;
+  long num_queries_;
+  std::mutex num_queries_mu_;
 };
 
 class MetricsServiceImpl GRPC_FINAL : public MetricsService::Service {
@@ -81,17 +92,17 @@
   grpc::Status GetGauge(ServerContext* context, const GaugeRequest* request,
                         GaugeResponse* response) GRPC_OVERRIDE;
 
-  // Create a Gauge with name 'name'. is_present is set to true if the Gauge
+  // Create a QpsGauge with name 'name'. is_present is set to true if the Gauge
   // is already present in the map.
-  // NOTE: CreateGauge can be called anytime (i.e before or after calling
+  // NOTE: CreateQpsGauge can be called anytime (i.e before or after calling
   // StartServer).
-  std::shared_ptr<Gauge> CreateGauge(const grpc::string& name,
+  std::shared_ptr<QpsGauge> CreateQpsGauge(const grpc::string& name,
                                      bool* already_present);
 
   std::unique_ptr<grpc::Server> StartServer(int port);
 
  private:
-  std::map<string, std::shared_ptr<Gauge>> gauges_;
+  std::map<string, std::shared_ptr<QpsGauge>> qps_gauges_;
   std::mutex mu_;
 };