diff options
author | Sree Kuchibhotla <sreek@google.com> | 2015-11-03 15:55:43 -0800 |
---|---|---|
committer | Sree Kuchibhotla <sreek@google.com> | 2015-11-03 15:55:43 -0800 |
commit | 4d0f2f9dab16162d41970e80c48d851f34b831bb (patch) | |
tree | 53b605b7f609eb641b30993995142134e93750b5 | |
parent | b5e98c5c69fe6ce9c069a7192385cd530c35f7a8 (diff) |
Fix typo in my previous commit. %s/guage/gauge/g
-rw-r--r-- | test/cpp/interop/metrics_client.cc | 20 | ||||
-rw-r--r-- | test/cpp/interop/stress_interop_client.cc | 4 | ||||
-rw-r--r-- | test/cpp/interop/stress_interop_client.h | 4 | ||||
-rw-r--r-- | test/cpp/interop/stress_test.cc | 6 | ||||
-rw-r--r-- | test/cpp/util/metrics_server.cc | 40 | ||||
-rw-r--r-- | test/cpp/util/metrics_server.h | 28 | ||||
-rw-r--r-- | test/proto/metrics.proto | 8 |
7 files changed, 55 insertions, 55 deletions
diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index 102d82a2a3..a1def7299a 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -46,7 +46,7 @@ DEFINE_string(metrics_server_address, "", "The metrics server addresses in the fomrat <hostname>:<port>"); using grpc::testing::EmptyMessage; -using grpc::testing::GuageResponse; +using grpc::testing::GaugeResponse; using grpc::testing::MetricsService; using grpc::testing::MetricsServiceImpl; @@ -60,19 +60,19 @@ void PrintMetrics(grpc::string& server_address) { grpc::ClientContext context; EmptyMessage message; - std::unique_ptr<grpc::ClientReader<GuageResponse>> reader( - stub->GetAllGuages(&context, message)); + std::unique_ptr<grpc::ClientReader<GaugeResponse>> reader( + stub->GetAllGauges(&context, message)); - GuageResponse guage_response; - long overall_rps = 0; + GaugeResponse gauge_response; + long overall_qps = 0; int idx = 0; - while (reader->Read(&guage_response)) { - gpr_log(GPR_INFO, "Guage: %d (%s: %ld)", ++idx, - guage_response.name().c_str(), guage_response.value()); - overall_rps += guage_response.value(); + while (reader->Read(&gauge_response)) { + gpr_log(GPR_INFO, "Gauge: %d (%s: %ld)", ++idx, + gauge_response.name().c_str(), gauge_response.value()); + overall_qps += gauge_response.value(); } - gpr_log(GPR_INFO, "OVERALL: %ld", overall_rps); + gpr_log(GPR_INFO, "OVERALL: %ld", overall_qps); const grpc::Status status = reader->Finish(); if (!status.ok()) { diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc index a68621c4e2..5d2951e3ed 100644 --- a/test/cpp/interop/stress_interop_client.cc +++ b/test/cpp/interop/stress_interop_client.cc @@ -94,7 +94,7 @@ StressTestInteropClient::StressTestInteropClient( sleep_duration_ms_(sleep_duration_ms), metrics_collection_interval_secs_(metrics_collection_interval_secs) {} -void StressTestInteropClient::MainLoop(std::shared_ptr<Guage> rps_guage) { +void StressTestInteropClient::MainLoop(std::shared_ptr<Gauge> qps_gauge) { gpr_log(GPR_INFO, "Running test %d. ServerAddr: %s", test_id_, server_address_.c_str()); @@ -120,7 +120,7 @@ void StressTestInteropClient::MainLoop(std::shared_ptr<Guage> rps_guage) { // See if its time to collect stats yet current_time = gpr_now(GPR_CLOCK_REALTIME); if (gpr_time_cmp(next_stat_collection_time, current_time) < 0) { - rps_guage->Set(num_calls_per_interval / + qps_gauge->Set(num_calls_per_interval / metrics_collection_interval_secs_); num_calls_per_interval = 0; diff --git a/test/cpp/interop/stress_interop_client.h b/test/cpp/interop/stress_interop_client.h index 8a769bb02f..567c1b0a6d 100644 --- a/test/cpp/interop/stress_interop_client.h +++ b/test/cpp/interop/stress_interop_client.h @@ -91,8 +91,8 @@ class StressTestInteropClient { long metrics_collection_interval_secs); // The main funciton. Use this as the thread entry point. - // rps_guage is the Guage to record the request per second metric - void MainLoop(std::shared_ptr<Guage> rps_guage); + // qps_gauge is the Gauge to record the requests per second metric + void MainLoop(std::shared_ptr<Gauge> qps_gauge); private: void RunTest(TestCaseType test_case); diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 0b940e6cb3..2d84c0d103 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -236,12 +236,12 @@ int main(int argc, char** argv) { FLAGS_sleep_duration_ms, FLAGS_metrics_collection_interval_secs); bool is_already_created; - grpc::string metricName = "/stress_test/rps/thread/" + std::to_string(i); + grpc::string metricName = "/stress_test/qps/thread/" + std::to_string(i); test_threads.emplace_back( thread(&StressTestInteropClient::MainLoop, client, - metrics_service.CreateGuage(metricName, is_already_created))); + metrics_service.CreateGauge(metricName, is_already_created))); - // The Guage should not have been already created + // The Gauge should not have been already created GPR_ASSERT(!is_already_created); } } diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc index 42a8911609..eac29f3093 100644 --- a/test/cpp/util/metrics_server.cc +++ b/test/cpp/util/metrics_server.cc @@ -45,37 +45,37 @@ namespace testing { using std::vector; -Guage::Guage(long initial_val) : val_(initial_val) {} +Gauge::Gauge(long initial_val) : val_(initial_val) {} -void Guage::Set(long new_val) { +void Gauge::Set(long new_val) { val_.store(new_val, std::memory_order_relaxed); } -long Guage::Get() { return val_.load(std::memory_order_relaxed); } +long Gauge::Get() { return val_.load(std::memory_order_relaxed); } -grpc::Status MetricsServiceImpl::GetAllGuages( +grpc::Status MetricsServiceImpl::GetAllGauges( ServerContext* context, const EmptyMessage* request, - ServerWriter<GuageResponse>* writer) { - gpr_log(GPR_INFO, "GetAllGuages called"); + ServerWriter<GaugeResponse>* writer) { + gpr_log(GPR_INFO, "GetAllGauges called"); std::lock_guard<std::mutex> lock(mu_); - for (auto it = guages_.begin(); it != guages_.end(); it++) { - GuageResponse resp; - resp.set_name(it->first); // Guage name - resp.set_value(it->second->Get()); // Guage value + for (auto it = gauges_.begin(); it != gauges_.end(); it++) { + GaugeResponse resp; + resp.set_name(it->first); // Gauge name + resp.set_value(it->second->Get()); // Gauge value writer->Write(resp); } return Status::OK; } -grpc::Status MetricsServiceImpl::GetGuage(ServerContext* context, - const GuageRequest* request, - GuageResponse* response) { +grpc::Status MetricsServiceImpl::GetGauge(ServerContext* context, + const GaugeRequest* request, + GaugeResponse* response) { std::lock_guard<std::mutex> lock(mu_); - auto it = guages_.find(request->name()); - if (it != guages_.end()) { + auto it = gauges_.find(request->name()); + if (it != gauges_.end()) { response->set_name(it->first); response->set_value(it->second->Get()); } @@ -83,15 +83,15 @@ grpc::Status MetricsServiceImpl::GetGuage(ServerContext* context, return Status::OK; } -std::shared_ptr<Guage> MetricsServiceImpl::CreateGuage(string name, +std::shared_ptr<Gauge> MetricsServiceImpl::CreateGauge(string name, bool& already_present) { std::lock_guard<std::mutex> lock(mu_); - std::shared_ptr<Guage> guage(new Guage(0)); - auto p = guages_.emplace(name, guage); + std::shared_ptr<Gauge> gauge(new Gauge(0)); + auto p = gauges_.emplace(name, gauge); - // p.first is an iterator pointing to <name, shared_ptr<Guage>> pair. p.second - // is a boolean indicating if the Guage is already present in the map + // p.first is an iterator pointing to <name, shared_ptr<Gauge>> pair. p.second + // is a boolean indicating if the Gauge is already present in the map already_present = !p.second; return p.first->second; } diff --git a/test/cpp/util/metrics_server.h b/test/cpp/util/metrics_server.h index c33d40e370..19c3a0c32e 100644 --- a/test/cpp/util/metrics_server.h +++ b/test/cpp/util/metrics_server.h @@ -43,16 +43,16 @@ /* * This implements a Metrics server defined in test/proto/metrics.proto. Any - * test service can use this to export Metrics (TODO (sreek): Only Guages for + * test service can use this to export Metrics (TODO (sreek): Only Gauges for * now). * * Example: * MetricsServiceImpl metricsImpl; * .. - * // Create Guage(s). Note: Guages can be created even after calling + * // Create Gauge(s). Note: Gauges can be created even after calling * // 'StartServer'. - * Guage guage1 = metricsImpl.CreateGuage("foo",is_present); - * // guage1 can now be used anywhere in the program to set values. + * Gauge gauge1 = metricsImpl.CreateGauge("foo",is_present); + * // gauge1 can now be used anywhere in the program to set values. * ... * // Create the metrics server * std::unique_ptr<grpc::Server> server = metricsImpl.StartServer(port); @@ -64,9 +64,9 @@ namespace testing { using std::map; using std::vector; -class Guage { +class Gauge { public: - Guage(long initial_val); + Gauge(long initial_val); void Set(long new_val); long Get(); @@ -76,22 +76,22 @@ class Guage { class MetricsServiceImpl GRPC_FINAL : public MetricsService::Service { public: - grpc::Status GetAllGuages(ServerContext* context, const EmptyMessage* request, - ServerWriter<GuageResponse>* writer) GRPC_OVERRIDE; + grpc::Status GetAllGauges(ServerContext* context, const EmptyMessage* request, + ServerWriter<GaugeResponse>* writer) GRPC_OVERRIDE; - grpc::Status GetGuage(ServerContext* context, const GuageRequest* request, - GuageResponse* response) GRPC_OVERRIDE; + grpc::Status GetGauge(ServerContext* context, const GaugeRequest* request, + GaugeResponse* response) GRPC_OVERRIDE; - // Create a Guage with name 'name'. is_present is set to true if the Guage + // Create a Gauge with name 'name'. is_present is set to true if the Gauge // is already present in the map. - // NOTE: CreateGuage can be called anytime (i.e before or after calling + // NOTE: CreateGauge can be called anytime (i.e before or after calling // StartServer). - std::shared_ptr<Guage> CreateGuage(string name, bool& is_present); + std::shared_ptr<Gauge> CreateGauge(string name, bool& is_present); std::unique_ptr<grpc::Server> StartServer(int port); private: - std::map<string, std::shared_ptr<Guage>> guages_; + std::map<string, std::shared_ptr<Gauge>> gauges_; std::mutex mu_; }; diff --git a/test/proto/metrics.proto b/test/proto/metrics.proto index fab670ea87..f434c95390 100644 --- a/test/proto/metrics.proto +++ b/test/proto/metrics.proto @@ -34,18 +34,18 @@ syntax = "proto3"; package grpc.testing; -message GuageResponse { +message GaugeResponse { string name = 1; int64 value = 2; } -message GuageRequest { +message GaugeRequest { string name = 1; } message EmptyMessage {} service MetricsService { - rpc GetAllGuages(EmptyMessage) returns (stream GuageResponse); - rpc GetGuage(GuageRequest) returns (GuageResponse); + rpc GetAllGauges(EmptyMessage) returns (stream GaugeResponse); + rpc GetGauge(GaugeRequest) returns (GaugeResponse); } |