added log_duration param and updated readme

pull/58/head
FlightlessMango 4 years ago
parent b4cd837328
commit e24f5dfc8b

@ -77,16 +77,14 @@ A partial list of parameters are below. See the config file for a complete list.
| `alpha` | Set the opacity of all text and frametime graph `0.0-1.0` |
| `background_alpha` | Set the opacity of the background `0.0-1.0` |
| `read_cfg` | Add to MANGOHUD_CONFIG as first parameter to also load config file. Otherwise only MANGOHUD_CONFIG parameters are used. |
| `output_file` | Define name and location of the output file (Required for logging) |
| `font_file` | Change default font (set location to .TTF/.OTF file ) |
| `log_duration` | Set amount of time the logging will run for (in seconds) |
Note: Width and Height are set automatically based on the font_size, but can be overridden.
Example: `MANGOHUD_CONFIG=cpu_temp,gpu_temp,position=top-right,height=500,font_size=32`
## Environment Variables
- `MANGOHUD_OUTPUT` : Define name and location of the output file (Required for logging)
- `MANGOHUD_FONT`: Change default font (set location to .TTF/.OTF file )
## Keybindings
- `F2` : Toggle Logging

@ -22,10 +22,8 @@ struct logData{
double fps, elapsedLog;
std::vector<logData> logArray;
ofstream out;
const char* log_duration_env = std::getenv("LOG_DURATION");
const char* mangohud_output_env = std::getenv("MANGOHUD_OUTPUT");
const char* log_period_env = std::getenv("LOG_PERIOD");
int duration, num;
int num;
bool loggingOn;
uint64_t log_start;
@ -39,8 +37,8 @@ uint64_t log_start;
// logArray.clear();
// }
void *logging(void *params_test){
overlay_params *params = reinterpret_cast<overlay_params *>(params_test);
void *logging(void *params_void){
overlay_params *params = reinterpret_cast<overlay_params *>(params_void);
time_t now_log = time(0);
tm *log_time = localtime(&now_log);
string date = to_string(log_time->tm_year + 1900) + "-" + to_string(1 + log_time->tm_mon) + "-" + to_string(log_time->tm_mday) + "_" + to_string(1 + log_time->tm_hour) + "-" + to_string(1 + log_time->tm_min) + "-" + to_string(1 + log_time->tm_sec);
@ -54,7 +52,7 @@ void *logging(void *params_test){
out << fps << "," << cpuLoadLog << "," << gpuLoadLog << "," << now - log_start << endl;
// logArray.push_back({fps, cpuLoadLog, gpuLoadLog, 0.0f});
if ((elapsedLog) >= duration * 1000000 && log_duration_env)
if ((elapsedLog) >= params->log_duration * 1000000 && params->log_duration)
loggingOn = false;
this_thread::sleep_for(chrono::milliseconds(log_period));

@ -873,9 +873,6 @@ void init_system_info(){
if (!log_period_env || !try_stoi(log_period, log_period_env))
log_period = 100;
if (log_duration_env && !try_stoi(duration, log_duration_env))
duration = 0;
}
void check_keybinds(struct overlay_params& params){
@ -1207,7 +1204,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2&
if (loggingOn && log_period == 0){
uint64_t now = os_time_get();
elapsedLog = (double)(now - log_start);
if ((elapsedLog) >= duration * 1000000)
if ((elapsedLog) >= params.log_duration * 1000000)
loggingOn = false;
out << fps << "," << cpuLoadLog << "," << gpuLoadLog << "," << (now - log_start) << endl;

@ -154,6 +154,7 @@ parse_str(const char *str)
#define parse_gl_vsync(s) parse_unsigned(s)
#define parse_offset_x(s) parse_unsigned(s)
#define parse_offset_y(s) parse_unsigned(s)
#define parse_log_duration(s) parse_unsigned(s)
#define parse_time_format(s) parse_str(s)
#define parse_output_file(s) parse_str(s)
#define parse_font_file(s) parse_str(s)

@ -95,6 +95,7 @@ extern "C" {
OVERLAY_PARAM_CUSTOM(io_color) \
OVERLAY_PARAM_CUSTOM(text_color) \
OVERLAY_PARAM_CUSTOM(alpha) \
OVERLAY_PARAM_CUSTOM(log_duration) \
OVERLAY_PARAM_CUSTOM(help)
enum overlay_param_position {
@ -129,6 +130,7 @@ struct overlay_params {
int offset_x, offset_y;
unsigned vsync;
int gl_vsync;
int log_duration;
unsigned crosshair_color, cpu_color, gpu_color, vram_color, ram_color, engine_color, io_color, frametime_color, background_color, text_color;
unsigned tableCols;
float font_size;

Loading…
Cancel
Save