/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
cloud/blockstore/tools/testing/loadtest/lib/action_graph.h
53 строки
1 KB
wilytiger
add loadtest to oss
29 сен 2023, 23:06
29 сен 2023, 23:06
c2f652a
Код
Авторство
О чём код?
#pragma once #include "public.h" #include <library/cpp/threading/future/future.h> #include <util/generic/vector.h> #include <util/system/event.h> #include <util/system/spinlock.h> #include <util/thread/pool.h> #include <functional> namespace NCloud::NBlockStore::NLoadTest { //////////////////////////////////////////////////////////////////////////////// struct TGraph { using TAction = std::function<void()>; TVector<TAction> Vertices; TVector<TVector<size_t>> Edges; }; using TVertexId = ui32; //////////////////////////////////////////////////////////////////////////////// class TGraphExecutor { private: TGraph Graph; TVector<ui32> Vertex2DepCount; TVector<TVector<TVertexId>> OutgoingEdges; TVector<TVertexId> Ready; TManualEvent ReadyEvent; ui32 DoneCount; TAdaptiveLock Lock; TAdaptiveThreadPool ThreadPool; public: TGraphExecutor(TGraph graph); public: void Run(); private: NThreading::TFuture<void> RunVertex(TVertexId vertexId); }; } // namespace NCloud::NBlockStore::NLoadTest