-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLog.cpp
56 lines (46 loc) · 1.11 KB
/
Log.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// Created by Eshin Griffith on 11/15/17.
//
#include <string>
#include <utility>
#include "Log.h"
#include <iostream>
#include <fstream>
void Log::appendLog(std::string name, std::string text) {
loglock.lock();
switch (logMap.count(name)){
case 0: logMap[name] = std::move(text);
case 1: logMap[name] = logMap[name]+text;
}
loglock.unlock();
}
void Log::increment(std::string, double val){
}
void Log::publish() {
loglock.lock();
std::ofstream ostrm ("../src/ProgramTranslate.txt", std::ios::binary);
ostrm << Summary() << '\n';
ostrm << logMap["RamDump"] << '\n';
loglock.unlock();
}
void Log::print() {
loglock.lock();
std::cout << Summary() << '\n';
for(auto k:logMap) std::cout << k.first << std::endl << k.second << '\n';
loglock.unlock();
}
Log::Log() {
logMap = std::map<std::string, std::string> ();
}
std::string Log::Summary() {
return fmt::format(R"(Summary
----------------------
Total runtime: {0}
Average runtime: {1}
Average completion period:
Average wait time:
cache density:
Ram density:
PF/IO density:
)", "Butt","Hole");
}