Skip to content

Commit

Permalink
Merge branch 'main' into cmakebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
alexv-smirnov committed Jan 23, 2025
2 parents 7897a54 + bd79c91 commit 4aafda4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
15 changes: 2 additions & 13 deletions ydb/library/workload/log/log.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#include "log.h"
#include <util/generic/serialized_enum.h>
#include <util/random/normal.h>
#include <util/random/random.h>
#include <util/datetime/base.h>

#include <cmath>
#include <iomanip>
#include <string>
#include <thread>
#include <random>
#include <sstream>
#include <chrono>
#include <format>

namespace NYdbWorkload {

namespace NLog {
Expand All @@ -22,8 +14,6 @@ using TRow = TLogGenerator::TRow;
TLogGenerator::TLogGenerator(const TLogWorkloadParams* params)
: TBase(params)
, TotalColumnsCnt(1 + Params.IntColumnsCnt + Params.StrColumnsCnt)
, RandomDevice()
, Mt19937(RandomDevice())
{
Y_ABORT_UNLESS(TotalColumnsCnt >= Params.KeyColumnsCnt);
}
Expand Down Expand Up @@ -209,10 +199,9 @@ TVector<std::string> TLogGenerator::GetCleanPaths() const {
TVector<TRow> TLogGenerator::GenerateRandomRows() {
TVector<TRow> result(Params.RowsCnt);

std::normal_distribution<double> normal_distribution_generator(0, static_cast<double>(Params.TimestampStandardDeviationMinutes));
for (size_t row = 0; row < Params.RowsCnt; ++row) {
result[row].Ts = TInstant::Now();
i64 millisecondsDiff = 60*1000*normal_distribution_generator(Mt19937);
i64 millisecondsDiff = 60 * 1000 * NormalRandom(0., static_cast<double>(Params.TimestampStandardDeviationMinutes));
if (millisecondsDiff >= 0) { // TDuration::MilliSeconds can't be negative for some reason...
result[row].Ts = result[row].Ts + TDuration::MilliSeconds(millisecondsDiff);
} else {
Expand Down
5 changes: 0 additions & 5 deletions ydb/library/workload/log/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <ydb/library/workload/abstract/workload_query_generator.h>

#include <cctype>
#include <random>
#include <sstream>

namespace NYdbWorkload {

Expand Down Expand Up @@ -102,9 +100,6 @@ class TLogGenerator final: public TWorkloadQueryGeneratorBase<TLogWorkloadParams
TVector<TRow> GenerateRandomRows();

const ui64 TotalColumnsCnt;

std::random_device RandomDevice;
std::mt19937 Mt19937;
};

} // namespace NLog
Expand Down

0 comments on commit 4aafda4

Please sign in to comment.