| Index: third_party/grpc/test/cpp/qps/driver.h
|
| diff --git a/third_party/tcmalloc/vendor/src/base/spinlock_internal.h b/third_party/grpc/test/cpp/qps/driver.h
|
| similarity index 56%
|
| copy from third_party/tcmalloc/vendor/src/base/spinlock_internal.h
|
| copy to third_party/grpc/test/cpp/qps/driver.h
|
| index 44942609f40a87492a7aeed0068a5e27bf9cd157..3af61f73917f35b9bdf929b6cb0c7009bb1b09f5 100644
|
| --- a/third_party/tcmalloc/vendor/src/base/spinlock_internal.h
|
| +++ b/third_party/grpc/test/cpp/qps/driver.h
|
| @@ -1,4 +1,6 @@
|
| -/* Copyright (c) 2010, Google Inc.
|
| +/*
|
| + *
|
| + * Copyright 2015-2016, Google Inc.
|
| * All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| @@ -27,38 +29,49 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| *
|
| - * ---
|
| - * This file is an internal part spinlock.cc and once.cc
|
| - * It may not be used directly by code outside of //base.
|
| */
|
|
|
| -#ifndef BASE_SPINLOCK_INTERNAL_H_
|
| -#define BASE_SPINLOCK_INTERNAL_H_
|
| +#ifndef TEST_QPS_DRIVER_H
|
| +#define TEST_QPS_DRIVER_H
|
| +
|
| +#include <memory>
|
|
|
| -#include <config.h>
|
| -#include "base/basictypes.h"
|
| -#include "base/atomicops.h"
|
| +#include "test/cpp/qps/histogram.h"
|
| +#include "src/proto/grpc/testing/control.grpc.pb.h"
|
|
|
| -namespace base {
|
| -namespace internal {
|
| +namespace grpc {
|
| +namespace testing {
|
| +class ResourceUsage {
|
| + public:
|
| + ResourceUsage(double w, double u, double s, int c)
|
| + : wall_time_(w), user_time_(u), system_time_(s), cores_(c) {}
|
| + double wall_time() const { return wall_time_; }
|
| + double user_time() const { return user_time_; }
|
| + double system_time() const { return system_time_; }
|
| + int cores() const { return cores_; }
|
|
|
| -// SpinLockWait() waits until it can perform one of several transitions from
|
| -// "from" to "to". It returns when it performs a transition where done==true.
|
| -struct SpinLockWaitTransition {
|
| - int32 from;
|
| - int32 to;
|
| - bool done;
|
| + private:
|
| + double wall_time_;
|
| + double user_time_;
|
| + double system_time_;
|
| + int cores_;
|
| };
|
|
|
| -// Wait until *w can transition from trans[i].from to trans[i].to for some i
|
| -// satisfying 0<=i<n && trans[i].done, atomically make the transition,
|
| -// then return the old value of *w. Make any other atomic tranistions
|
| -// where !trans[i].done, but continue waiting.
|
| -int32 SpinLockWait(volatile Atomic32 *w, int n,
|
| - const SpinLockWaitTransition trans[]);
|
| -void SpinLockWake(volatile Atomic32 *w, bool all);
|
| -void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop);
|
| +struct ScenarioResult {
|
| + Histogram latencies;
|
| + std::vector<ResourceUsage> client_resources;
|
| + std::vector<ResourceUsage> server_resources;
|
| + ClientConfig client_config;
|
| + ServerConfig server_config;
|
| +};
|
| +
|
| +std::unique_ptr<ScenarioResult> RunScenario(
|
| + const grpc::testing::ClientConfig& client_config, size_t num_clients,
|
| + const grpc::testing::ServerConfig& server_config, size_t num_servers,
|
| + int warmup_seconds, int benchmark_seconds, int spawn_local_worker_count);
|
| +
|
| +void RunQuit();
|
| +} // namespace testing
|
| +} // namespace grpc
|
|
|
| -} // namespace internal
|
| -} // namespace base
|
| #endif
|
|
|