mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-18 08:59:59 +00:00
lm: Flush manager output on core shutdown
This commit is contained in:
parent
fa6531ab0f
commit
6212df3beb
5 changed files with 15 additions and 11 deletions
|
@ -250,6 +250,8 @@ struct System::Impl {
|
||||||
telemetry_session->AddField(Telemetry::FieldType::Performance, "Mean_Frametime_MS",
|
telemetry_session->AddField(Telemetry::FieldType::Performance, "Mean_Frametime_MS",
|
||||||
perf_stats->GetMeanFrametime());
|
perf_stats->GetMeanFrametime());
|
||||||
|
|
||||||
|
lm_manager.Flush();
|
||||||
|
|
||||||
is_powered_on = false;
|
is_powered_on = false;
|
||||||
exit_lock = false;
|
exit_lock = false;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Service::LM {
|
||||||
std::ostream& operator<<(std::ostream& os, DestinationFlag dest) {
|
std::ostream& operator<<(std::ostream& os, DestinationFlag dest) {
|
||||||
std::vector<std::string> array;
|
std::vector<std::string> array;
|
||||||
const auto check_single_flag = [dest, &array](DestinationFlag check, std::string name) {
|
const auto check_single_flag = [dest, &array](DestinationFlag check, std::string name) {
|
||||||
if ((static_cast<u32>(check) & static_cast<u32>(dest)) > 0) {
|
if ((static_cast<u32>(check) & static_cast<u32>(dest)) != 0) {
|
||||||
array.emplace_back(std::move(name));
|
array.emplace_back(std::move(name));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -75,7 +75,7 @@ std::string FormatField(Field type, const std::vector<u8>& data) {
|
||||||
if (data.size() >= sizeof(u32)) {
|
if (data.size() >= sizeof(u32)) {
|
||||||
u32 line;
|
u32 line;
|
||||||
std::memcpy(&line, data.data(), sizeof(u32));
|
std::memcpy(&line, data.data(), sizeof(u32));
|
||||||
return fmt::format("{:08X}", line);
|
return fmt::format("{}", line);
|
||||||
}
|
}
|
||||||
return "[ERROR DECODING LINE NUMBER]";
|
return "[ERROR DECODING LINE NUMBER]";
|
||||||
case Field::Message:
|
case Field::Message:
|
||||||
|
@ -114,16 +114,20 @@ void Manager::Log(LogMessage message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Manager::Flush() {
|
||||||
|
FinalizeLog();
|
||||||
|
}
|
||||||
|
|
||||||
void Manager::InitializeLog() {
|
void Manager::InitializeLog() {
|
||||||
current_log.clear();
|
current_log.clear();
|
||||||
|
|
||||||
LOG_INFO(Service_LM, "Initialized new log session!");
|
LOG_INFO(Service_LM, "Initialized new log session");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::FinalizeLog() {
|
void Manager::FinalizeLog() {
|
||||||
reporter.SaveLogReport(static_cast<u32>(destination), std::move(current_log));
|
reporter.SaveLogReport(static_cast<u32>(destination), std::move(current_log));
|
||||||
|
|
||||||
LOG_INFO(Service_LM, "Finalized current log session!");
|
LOG_INFO(Service_LM, "Finalized current log session");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::LM
|
} // namespace Service::LM
|
||||||
|
|
|
@ -81,7 +81,7 @@ std::string FormatField(Field type, const std::vector<u8>& data);
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
public:
|
public:
|
||||||
Manager(Core::Reporter& reporter);
|
explicit Manager(Core::Reporter& reporter);
|
||||||
~Manager();
|
~Manager();
|
||||||
|
|
||||||
void SetEnabled(bool enabled);
|
void SetEnabled(bool enabled);
|
||||||
|
@ -89,6 +89,8 @@ public:
|
||||||
|
|
||||||
void Log(LogMessage message);
|
void Log(LogMessage message);
|
||||||
|
|
||||||
|
void Flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeLog();
|
void InitializeLog();
|
||||||
void FinalizeLog();
|
void FinalizeLog();
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fmt/ostream.h>
|
#include <fmt/ostream.h>
|
||||||
#include <fmt/time.h>
|
|
||||||
#include <json.hpp>
|
#include <json.hpp>
|
||||||
|
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
|
@ -393,11 +392,11 @@ void Reporter::SaveLogReport(u32 destination, std::vector<Service::LM::LogMessag
|
||||||
out["type"] = fmt::format("{}", kv.first);
|
out["type"] = fmt::format("{}", kv.first);
|
||||||
out["data"] =
|
out["data"] =
|
||||||
Service::LM::FormatField(kv.first, kv.second);
|
Service::LM::FormatField(kv.first, kv.second);
|
||||||
return std::move(out);
|
return out;
|
||||||
});
|
});
|
||||||
|
|
||||||
out["fields"] = std::move(fields);
|
out["fields"] = std::move(fields);
|
||||||
return std::move(out);
|
return out;
|
||||||
});
|
});
|
||||||
|
|
||||||
out["log_messages"] = std::move(json_messages);
|
out["log_messages"] = std::move(json_messages);
|
||||||
|
|
|
@ -59,9 +59,6 @@ public:
|
||||||
New,
|
New,
|
||||||
System,
|
System,
|
||||||
};
|
};
|
||||||
// Used by prepo services
|
|
||||||
void SavePlayReport(u64 title_id, u64 process_id, std::vector<std::vector<u8>> data,
|
|
||||||
std::optional<u128> user_id = {}) const;
|
|
||||||
|
|
||||||
void SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data,
|
void SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data,
|
||||||
std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
|
std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
|
||||||
|
|
Loading…
Reference in a new issue