diff options
Diffstat (limited to 'src/core/perf_stats.cpp')
| -rw-r--r-- | src/core/perf_stats.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index c42c437b7..6635a1339 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp | |||
| @@ -11,7 +11,9 @@ | |||
| 11 | #include <thread> | 11 | #include <thread> |
| 12 | #include <fmt/chrono.h> | 12 | #include <fmt/chrono.h> |
| 13 | #include <fmt/format.h> | 13 | #include <fmt/format.h> |
| 14 | #include "common/file_util.h" | 14 | #include "common/fs/file.h" |
| 15 | #include "common/fs/fs.h" | ||
| 16 | #include "common/fs/path_util.h" | ||
| 15 | #include "common/math_util.h" | 17 | #include "common/math_util.h" |
| 16 | #include "common/settings.h" | 18 | #include "common/settings.h" |
| 17 | #include "core/perf_stats.h" | 19 | #include "core/perf_stats.h" |
| @@ -38,12 +40,17 @@ PerfStats::~PerfStats() { | |||
| 38 | std::ostringstream stream; | 40 | std::ostringstream stream; |
| 39 | std::copy(perf_history.begin() + IgnoreFrames, perf_history.begin() + current_index, | 41 | std::copy(perf_history.begin() + IgnoreFrames, perf_history.begin() + current_index, |
| 40 | std::ostream_iterator<double>(stream, "\n")); | 42 | std::ostream_iterator<double>(stream, "\n")); |
| 41 | const std::string& path = Common::FS::GetUserPath(Common::FS::UserPath::LogDir); | 43 | |
| 44 | const auto path = Common::FS::GetYuzuPath(Common::FS::YuzuPath::LogDir); | ||
| 42 | // %F Date format expanded is "%Y-%m-%d" | 45 | // %F Date format expanded is "%Y-%m-%d" |
| 43 | const std::string filename = | 46 | const auto filename = fmt::format("{:%F-%H-%M}_{:016X}.csv", *std::localtime(&t), title_id); |
| 44 | fmt::format("{}/{:%F-%H-%M}_{:016X}.csv", path, *std::localtime(&t), title_id); | 47 | const auto filepath = path / filename; |
| 45 | Common::FS::IOFile file(filename, "w"); | 48 | |
| 46 | file.WriteString(stream.str()); | 49 | if (Common::FS::CreateParentDir(filepath)) { |
| 50 | Common::FS::IOFile file(filepath, Common::FS::FileAccessMode::Write, | ||
| 51 | Common::FS::FileType::TextFile); | ||
| 52 | void(file.WriteString(stream.str())); | ||
| 53 | } | ||
| 47 | } | 54 | } |
| 48 | 55 | ||
| 49 | void PerfStats::BeginSystemFrame() { | 56 | void PerfStats::BeginSystemFrame() { |