|
@@ -21,6 +21,8 @@
|
|
|
|
|
|
#include <grpc/support/port_platform.h>
|
|
|
|
|
|
+#include <limits>
|
|
|
+
|
|
|
#include <grpc/impl/codegen/grpc_types.h>
|
|
|
#include <grpc/support/atm.h>
|
|
|
#include <grpc/support/cpu.h>
|
|
@@ -132,7 +134,12 @@ class ExecCtx {
|
|
|
ExecCtx(const ExecCtx&) = delete;
|
|
|
ExecCtx& operator=(const ExecCtx&) = delete;
|
|
|
|
|
|
- unsigned starting_cpu() const { return starting_cpu_; }
|
|
|
+ unsigned starting_cpu() {
|
|
|
+ if (starting_cpu_ == std::numeric_limits<unsigned>::max()) {
|
|
|
+ starting_cpu_ = gpr_cpu_current_cpu();
|
|
|
+ }
|
|
|
+ return starting_cpu_;
|
|
|
+ }
|
|
|
|
|
|
struct CombinerData {
|
|
|
/* currently active combiner: updated only via combiner.c */
|
|
@@ -239,7 +246,7 @@ class ExecCtx {
|
|
|
CombinerData combiner_data_ = {nullptr, nullptr};
|
|
|
uintptr_t flags_;
|
|
|
|
|
|
- unsigned starting_cpu_ = gpr_cpu_current_cpu();
|
|
|
+ unsigned starting_cpu_ = std::numeric_limits<unsigned>::max();
|
|
|
|
|
|
bool now_is_valid_ = false;
|
|
|
grpc_millis now_ = 0;
|