内存优化
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <memory_resource>
|
||||
#include <string_view>
|
||||
#include "Data_Source_Handler.h"
|
||||
namespace Psc {
|
||||
@@ -176,6 +177,9 @@ public:
|
||||
virtual asio::awaitable<void> handle_in_loop_coro() {
|
||||
co_return;
|
||||
}
|
||||
virtual bool discard_input_packet(std::string_view) {
|
||||
return false;
|
||||
}
|
||||
Frequency_Limit statistic_fl;
|
||||
Psc::JSON statistic_json() {
|
||||
Psc::JSON ret = With_Loop_Coro::to_base_json();
|
||||
@@ -459,19 +463,14 @@ struct Type_Descriptor<Dll_Data_Source_Data> {
|
||||
class Dll_Data_Source : public Data_Source {
|
||||
public:
|
||||
adminive::Managed_Value<Dll_Data_Source_Data> specific;
|
||||
Psc::JSON get_custom_state_json() override {
|
||||
std::lock_guard lock(state_mtx);
|
||||
Psc::JSON ret = Psc::JSON::object();
|
||||
ret.append({"state", state});
|
||||
ret.append({"library_read", read_statistics.to_json()});
|
||||
return ret;
|
||||
}
|
||||
Psc::JSON get_custom_state_json() override;
|
||||
Psc::JSON backlog_state_json() const;
|
||||
Psc::Throughput_Statistics read_statistics;
|
||||
Dll_Data_Source() {
|
||||
type = "Dll_Data_Source";
|
||||
}
|
||||
~Dll_Data_Source() override = default;
|
||||
std::vector<std::uint8_t> buffer;
|
||||
std::pmr::vector<std::uint8_t> buffer;
|
||||
void from_json(const Psc::JSON* that_json) override {
|
||||
Data_Source::from_json(that_json);
|
||||
const auto buffer_size = specific.write([&](auto& value) {
|
||||
@@ -521,7 +520,20 @@ public:
|
||||
}
|
||||
co_return;
|
||||
}
|
||||
bool discard_input_packet(std::string_view packet) override;
|
||||
void origin_data_transform_mode_data(std::string& data) override;
|
||||
private:
|
||||
static constexpr std::size_t backlog_read_size = 8 * 1024 * 1024;
|
||||
bool drop_mode_ac_for_batch_{};
|
||||
std::atomic_bool backlog_active_{};
|
||||
std::atomic<std::uint64_t> backlog_events_total_{};
|
||||
std::atomic<std::uint64_t> backlog_batches_total_{};
|
||||
std::atomic<std::uint64_t> backlog_raw_bytes_total_{};
|
||||
std::atomic<std::uint64_t> dropped_mode_ac_frames_total_{};
|
||||
std::atomic<std::uint64_t> dropped_mode_ac_bytes_total_{};
|
||||
std::atomic<std::size_t> last_batch_raw_bytes_{};
|
||||
std::atomic<std::size_t> largest_batch_raw_bytes_{};
|
||||
std::atomic<std::size_t> last_read_request_bytes_{};
|
||||
};
|
||||
class Shared_Memory_Data_Source_Data {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user