diff options
author | Tor Egge <Tor.Egge@oath.com> | 2018-03-05 12:13:21 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2018-03-05 12:28:32 +0000 |
commit | 4da2c2c885062659e0c86f76061065f9ac4dc216 (patch) | |
tree | 2a6b27752704ce8c05fac1af3115f87b72915e91 /vespalib | |
parent | 8ce3e8d16fd1c9297d663808fff27cb62f52f924 (diff) |
Collect executor stats once per metrics update and pass the info to both
metrics update method for document db legacy metrics and to metrics update
method for tagged document db metrics.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/executor_stats.h | 18 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h | 8 |
2 files changed, 20 insertions, 6 deletions
diff --git a/vespalib/src/vespa/vespalib/util/executor_stats.h b/vespalib/src/vespa/vespalib/util/executor_stats.h new file mode 100644 index 00000000000..e8adfc62807 --- /dev/null +++ b/vespalib/src/vespa/vespalib/util/executor_stats.h @@ -0,0 +1,18 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +namespace vespalib { + +/** + * Struct representing stats for an executor. + **/ +struct ExecutorStats { + size_t maxPendingTasks; + size_t acceptedTasks; + size_t rejectedTasks; + ExecutorStats() : maxPendingTasks(0), acceptedTasks(0), rejectedTasks(0) {} +}; + +} + diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index 1d8545781f5..9679e6379f5 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -11,6 +11,7 @@ #include <memory> #include <vector> #include <functional> +#include "executor_stats.h" class FastOS_ThreadPool; @@ -39,12 +40,7 @@ public: * Internal stats that we want to observe externally. Note that * all stats are reset each time they are observed. **/ - struct Stats { - size_t maxPendingTasks; - size_t acceptedTasks; - size_t rejectedTasks; - Stats() : maxPendingTasks(0), acceptedTasks(0), rejectedTasks(0) {} - }; + using Stats = ExecutorStats; using init_fun_t = std::function<int(Runnable&)>; |