Skip to content

Commit 445eaa8

Browse files
committed
Tweaks
1 parent 73867b4 commit 445eaa8

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

Options.cc

+7-11
Original file line numberDiff line numberDiff line change
@@ -396,25 +396,21 @@ void Options::UpdateDAC(std::map<int, std::map<std::string, std::vector<double>>
396396
return;
397397
}
398398

399-
void Options::SaveBenchmarks(std::map<std::string, std::map<int, long>>& counters, long bytes,
400-
std::string sid, std::map<std::string, double>& times) {
399+
void Options::SaveBenchmarks(std::map<std::string, std::map<int, long>>& counters,
400+
long bytes, std::string sid, std::map<std::string, double>& times) {
401401
using namespace bsoncxx::builder::stream;
402-
int level = GetInt("benchmark_level", 2);
402+
int level = GetInt("benchmark_level", 1);
403403
if (level == 0) return;
404-
int run_id = -1;
405-
try{
406-
run_id = std::stoi(GetString("run_identifier", "latest"));
407-
} catch (...) {
408-
}
404+
int run_id = GetInt("number", -1);
409405
std::map<std::string, std::map<int, long>> _counters;
410-
if (level == 2) {
406+
if (level == 1) {
411407
for (const auto& p : counters)
412408
for (const auto& pp : p.second)
413409
if (pp.first != 0)
414-
_counters[p.first][int(std::floor(std::log2(pp.first)))] += pp.second;
410+
_counters[p.first][int(std::log2(pp.first))] += pp.second;
415411
else
416412
_counters[p.first][-1] += pp.second;
417-
} else if (level == 3) {
413+
} else if (level == 2) {
418414
_counters = counters;
419415
}
420416

StraxFormatter.cc

+3-6
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ void StraxFormatter::Process() {
291291
std::stringstream ss;
292292
ss<<fHostname<<'_'<<fThreadId;
293293
fFullHostname = ss.str();
294-
fActive = fRunning = true;
294+
fActive = true;
295295
std::unique_ptr<data_packet> dp;
296-
while (fActive == true) {
296+
while (fActive == true || fBuffer.size() > 0) {
297297
std::unique_lock<std::mutex> lk(fBufferMutex);
298298
fCV.wait(lk, [&]{return fBuffer.size() > 0 || fActive == false;});
299299
if (fBuffer.size() > 0) {
@@ -308,9 +308,6 @@ void StraxFormatter::Process() {
308308
}
309309
if (fBytesProcessed > 0)
310310
End();
311-
fRunning = false;
312-
if (fBuffer.size() > 0)
313-
fLog->Entry(MongoLog::Warning, "%i DPs unprocessed", fBuffer.size());
314311
}
315312

316313
// Can tune here as needed, these are defaults from the LZ4 examples
@@ -326,7 +323,7 @@ void StraxFormatter::WriteOutChunk(int chunk_i){
326323
struct timespec comp_start, comp_end;
327324
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &comp_start);
328325

329-
std::vector<std::list<std::string>*> buffers = {&fChunks[chunk_i], &fOverlaps[chunk_i]};
326+
std::vector<std::list<std::string>*> buffers{{&fChunks[chunk_i], &fOverlaps[chunk_i]}};
330327
std::vector<long> uncompressed_size(3, 0);
331328
std::string uncompressed;
332329
std::vector<std::shared_ptr<std::string>> out_buffer(3);

StraxFormatter.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private:
9191
std::string fOutputPath, fHostname, fFullHostname;
9292
std::shared_ptr<Options> fOptions;
9393
std::shared_ptr<MongoLog> fLog;
94-
std::atomic_bool fActive, fRunning;
94+
std::atomic_bool fActive;
9595
std::string fCompressor;
9696
std::map<int, std::list<std::string>> fChunks, fOverlaps;
9797
std::map<int, int> fFailCounter;

0 commit comments

Comments
 (0)