Merge branch 'master' into develop

pull/131/head
FlightlessMango 4 years ago
commit d6314da8b2

11
.gitignore vendored

@ -1,11 +1,12 @@
build/ build
builddir/ builddir
__pycache__/ __pycache__
.vscode/ .vscode
MangoHud*.tar.gz MangoHud*.tar.gz
pkg/* pkg
mangohud*.tar.* mangohud*.tar.*
lib32-mangohud*.tar.* lib32-mangohud*.tar.*
v*.tar.gz
# Prerequisites # Prerequisites
*.d *.d

@ -61,7 +61,7 @@ If you are using Flatpaks, you will have to add the [Flathub repository](https:/
##### For Steam flatpak ##### For Steam flatpak
``` ```
flatpak install com.valvesoftware.Steam.VulkanLayer.MangoHud flatpak install com.valvesoftware.Steam.Utility.MangoHud
``` ```
To enable MangoHud for all Steam games: To enable MangoHud for all Steam games:
``` ```

@ -0,0 +1,8 @@
#!/bin/sh
VERSION=$(git describe --long --tags --always | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//')
EXCLUDE_PATTERN="--exclude-vcs --exclude-vcs-ignores"
tar -cf v$VERSION.tar.gz $EXCLUDE_PATTERN .
tar -cf v$VERSION-DFSG.tar.gz $EXCLUDE_PATTERN --exclude=include/nvml.h .

@ -217,7 +217,16 @@ usage() {
else else
echo "$0 requires one argument" echo "$0 requires one argument"
fi fi
echo 'Accepted arguments: "pull", "configure", "build", "package", "install", "clean", "uninstall".' echo -e "\nUsage: $0 <command>\n"
echo "Available commands:"
echo -e "\tpull\t\tPull latest commits (code) from Git"
echo -e "\tconfigure\tEnsures that dependencies are installed, updates git submodules, and generates files needed for building MangoHud. This is automatically run by the build command"
echo -e "\tbuild\t\tIf needed runs configure and then builds (compiles) MangoHud"
echo -e "\tpackage\t\tRuns build if needed and then builds a tar package from MangoHud"
echo -e "\tinstall\t\tInstall MangoHud onto your system"
echo -e "\tclean\t\tRemoves build directory"
echo -e "\tuninstall\tRemoves installed MangoHud files from your system"
echo -e "\trelease\t\tBuilds a MangoHud release tar package"
} }
for a in $@; do for a in $@; do

@ -222,5 +222,11 @@ if cc.sizeof('void*') == 4
pre_args += '-DMANGOHUD_ARCH="32bit"' pre_args += '-DMANGOHUD_ARCH="32bit"'
endif endif
if get_option('use_system_nvml')
cpp_nvml_args = '-DUSE_SYSTEM_NVML'
else
cpp_nvml_args = []
endif
subdir('modules/ImGui') subdir('modules/ImGui')
subdir('src') subdir('src')

@ -1,5 +1,6 @@
option('glibcxx_asserts', type : 'boolean', value : false) option('glibcxx_asserts', type : 'boolean', value : false)
option('use_system_vulkan', type : 'feature', value : 'disabled', description: 'Use system vulkan headers instead of the provided ones') option('use_system_vulkan', type : 'feature', value : 'disabled', description: 'Use system vulkan headers instead of the provided ones')
option('use_system_nvml', type : 'boolean', value : false, description : 'Use system nvml headers instead of the provided ones')
option('mangohud_prefix', type : 'string', value : '', description: 'Add prefix to cross-compiled library, like "lib32-".') option('mangohud_prefix', type : 'string', value : '', description: 'Add prefix to cross-compiled library, like "lib32-".')
option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.') option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.')
option('include_doc', type : 'boolean', value : true, description: 'Include the example config') option('include_doc', type : 'boolean', value : true, description: 'Include the example config')

@ -4,7 +4,11 @@
#ifndef LIBRARY_LOADER_NVML_H #ifndef LIBRARY_LOADER_NVML_H
#define LIBRARY_LOADER_NVML_H #define LIBRARY_LOADER_NVML_H
#if USE_SYSTEM_NVML
#include <nvml.h>
#else
#include "nvml.h" #include "nvml.h"
#endif
#define LIBRARY_LOADER_NVML_H_DLOPEN #define LIBRARY_LOADER_NVML_H_DLOPEN
#include <string> #include <string>

@ -10,16 +10,16 @@ using namespace std;
string os, cpu, gpu, ram, kernel, driver; string os, cpu, gpu, ram, kernel, driver;
bool sysInfoFetched = false; bool sysInfoFetched = false;
int gpuLoadLog = 0, cpuLoadLog = 0, log_period = 0; int gpuLoadLog = 0, cpuLoadLog = 0, log_period = 0, elapsedLog;
struct logData{ struct logData{
double fps; double fps;
double cpu; int cpu;
double gpu; int gpu;
double previous; int previous;
}; };
double fps, elapsedLog; double fps;
std::vector<logData> logArray; std::vector<logData> logArray;
ofstream out; ofstream out;
const char* log_period_env = std::getenv("LOG_PERIOD"); const char* log_period_env = std::getenv("LOG_PERIOD");
@ -27,37 +27,43 @@ int num;
bool loggingOn; bool loggingOn;
uint64_t log_start; uint64_t log_start;
// void writeFile(string date){ void writeFile(string filename){
// out.open(mangohud_output_env + date, ios::out | ios::app); out.open(filename, ios::out | ios::app);
// for (size_t i = 0; i < logArray.size(); i++) { for (size_t i = 0; i < logArray.size(); i++)
// out << logArray[i].fps << "," << logArray[i].cpu << "," << logArray[i].gpu << endl; out << logArray[i].fps << "," << logArray[i].cpu << "," << logArray[i].gpu << "," << logArray[i].previous << endl;
// }
// out.close(); out.close();
// logArray.clear(); logArray.clear();
// } }
void *logging(void *params_void){ void *logging(void *params_void){
overlay_params *params = reinterpret_cast<overlay_params *>(params_void); overlay_params *params = reinterpret_cast<overlay_params *>(params_void);
time_t now_log = time(0); time_t now_log = time(0);
tm *log_time = localtime(&now_log); 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); 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);
log_start = os_time_get(); log_start = os_time_get();
out.open(params->output_file + date, ios::out | ios::app); out.open(params->output_file + date, ios::out | ios::app);
out << "os," << "cpu," << "gpu," << "ram," << "kernel," << "driver" << endl; out << "os," << "cpu," << "gpu," << "ram," << "kernel," << "driver" << endl;
out << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << endl; out << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << endl;
while (loggingOn){ out.close();
while (loggingOn){
uint64_t now = os_time_get(); uint64_t now = os_time_get();
elapsedLog = (double)(now - log_start); elapsedLog = now - log_start;
out << fps << "," << cpuLoadLog << "," << gpuLoadLog << "," << now - log_start << endl; logArray.push_back({fps, cpuLoadLog, gpuLoadLog, elapsedLog});
// logArray.push_back({fps, cpuLoadLog, gpuLoadLog, 0.0f});
if ((elapsedLog) >= params->log_duration * 1000000 && params->log_duration) if (params->log_duration && (elapsedLog) >= params->log_duration * 1000000)
loggingOn = false; loggingOn = false;
else
this_thread::sleep_for(chrono::milliseconds(log_period)); this_thread::sleep_for(chrono::milliseconds(log_period));
} }
// writeFile(date);
out.close(); writeFile(params->output_file + date);
return NULL; return NULL;
} }

@ -117,6 +117,7 @@ vklayer_mesa_overlay = shared_library(
cpp_args : [ cpp_args : [
pre_args, pre_args,
cpp_vis_args, cpp_vis_args,
cpp_nvml_args,
vulkan_wsi_args vulkan_wsi_args
], ],
dependencies : [ dependencies : [

Loading…
Cancel
Save