diff --git a/.github/workflows/linux_llvm_cov.yml b/.github/workflows/linux_llvm_cov.yml index 54135d57..0b74cba8 100644 --- a/.github/workflows/linux_llvm_cov.yml +++ b/.github/workflows/linux_llvm_cov.yml @@ -43,7 +43,7 @@ jobs: ./test_metric llvm-profdata merge -sparse test_cinatra-*.profraw -o test_cinatra.profdata - llvm-cov show test_cinatra -object test_corofile -object test_time_util -object test_http_parse -object test_metric -instr-profile=test_cinatra.profdata -format=html -output-dir=../.coverage_llvm_cov -ignore-filename-regex="example|asio|cmdline|async_simple|tests" -show-instantiations=false + llvm-cov show -object test_cinatra -object test_corofile -object test_time_util -object test_http_parse -object test_metric -instr-profile=test_cinatra.profdata -format=html -output-dir=../.coverage_llvm_cov -ignore-filename-regex="example|asio|cmdline|async_simple|tests" -show-instantiations=false echo "Done!" - name: Upload Coverage Results @@ -58,7 +58,7 @@ jobs: echo "Code Coverage Report" > tmp.log echo "for detail, [goto summary](https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/actions/runs/${{github.run_id}}) download Artifacts `llvm-cov`" >> tmp.log echo "\`\`\`" >> tmp.log - llvm-cov report test_cinatra -object test_corofile -object test_time_util -object test_http_parse -instr-profile=test_cinatra.profdata -ignore-filename-regex="example|asio|cmdline|async_simple|tests" -show-region-summary=false >> tmp.log + llvm-cov report -object test_cinatra -object test_corofile -object test_time_util -object test_http_parse -instr-profile=test_cinatra.profdata -ignore-filename-regex="example|asio|cmdline|async_simple|tests" -show-region-summary=false >> tmp.log echo "\`\`\`" >> tmp.log - name: Create Comment diff --git a/include/cinatra/ylt/coro_io/coro_io.hpp b/include/cinatra/ylt/coro_io/coro_io.hpp index f22b9144..3992116c 100644 --- a/include/cinatra/ylt/coro_io/coro_io.hpp +++ b/include/cinatra/ylt/coro_io/coro_io.hpp @@ -364,12 +364,11 @@ post(Func func, } template -struct coro_channel - : public asio::experimental::channel { +struct channel : public asio::experimental::channel { using return_type = R; using ValueType = std::pair; using asio::experimental::channel::channel; - coro_channel(coro_io::ExecutorWrapper<> *executor, size_t capacity) + channel(coro_io::ExecutorWrapper<> *executor, size_t capacity) : executor_(executor), asio::experimental::channel( executor->get_asio_executor(), capacity) {} @@ -380,17 +379,17 @@ struct coro_channel }; template -inline coro_channel create_channel( +inline channel create_channel( size_t capacity, coro_io::ExecutorWrapper<> *executor = coro_io::get_global_executor()) { - return coro_channel(executor, capacity); + return channel(executor, capacity); } template inline auto create_shared_channel( size_t capacity, coro_io::ExecutorWrapper<> *executor = coro_io::get_global_executor()) { - return std::make_shared>(executor, capacity); + return std::make_shared>(executor, capacity); } template diff --git a/include/cinatra/ylt/metric/dynamic_metric.hpp b/include/cinatra/ylt/metric/dynamic_metric.hpp index 02533bbe..df024e54 100644 --- a/include/cinatra/ylt/metric/dynamic_metric.hpp +++ b/include/cinatra/ylt/metric/dynamic_metric.hpp @@ -2,6 +2,7 @@ #include #include "metric.hpp" +#include "thread_local_value.hpp" #if __has_include("ylt/util/type_traits.h") #include "ylt/util/map_sharded.hpp" #else @@ -12,6 +13,8 @@ namespace ylt::metric { class dynamic_metric : public metric_t { public: + static inline auto g_user_metric_label_count = + new thread_local_value(std::thread::hardware_concurrency()); using metric_t::metric_t; }; diff --git a/include/cinatra/ylt/metric/metric.hpp b/include/cinatra/ylt/metric/metric.hpp index cd395268..fddd50f3 100644 --- a/include/cinatra/ylt/metric/metric.hpp +++ b/include/cinatra/ylt/metric/metric.hpp @@ -53,8 +53,6 @@ struct metric_filter_options { class metric_t { public: static inline std::atomic g_user_metric_count = 0; - static inline auto g_user_metric_label_count = - new thread_local_value(std::thread::hardware_concurrency()); metric_t() = default; metric_t(MetricType type, std::string name, std::string help) : type_(type), diff --git a/include/cinatra/ylt/metric/system_metric.hpp b/include/cinatra/ylt/metric/system_metric.hpp index 50c36f31..7d286caf 100644 --- a/include/cinatra/ylt/metric/system_metric.hpp +++ b/include/cinatra/ylt/metric/system_metric.hpp @@ -601,7 +601,7 @@ inline void stat_metric() { system_metric_manager::instance().get_metric_static( "ylt_user_metric_labels"); user_metric_label_count->update( - metric::metric_t::g_user_metric_label_count->value()); + dynamic_metric::g_user_metric_label_count->value()); } inline void ylt_stat() {