perf: async signal exit ftpsrv and nxlink thread in order to not block. add perf logging for exit.
This commit is contained in:
@@ -6,6 +6,7 @@ namespace sphaira::ftpsrv {
|
||||
|
||||
bool Init();
|
||||
void Exit();
|
||||
void ExitSignal();
|
||||
|
||||
using OnInstallStart = std::function<bool(const char* path)>;
|
||||
using OnInstallWrite = std::function<bool(const void* buf, size_t size)>;
|
||||
|
||||
@@ -44,6 +44,9 @@ bool nxlinkInitialize(NxlinkCallback callback);
|
||||
// signal for the event to close and then join the thread.
|
||||
void nxlinkExit();
|
||||
|
||||
// async the exit, call this first and then call exit later to avoid blocking.
|
||||
void nxlinkSignalExit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
24
sphaira/include/utils/profile.hpp
Normal file
24
sphaira/include/utils/profile.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui/types.hpp"
|
||||
#include "log.hpp"
|
||||
|
||||
namespace sphaira::utils {
|
||||
|
||||
struct ScopedTimestampProfile {
|
||||
ScopedTimestampProfile(const std::string& name) : m_name{name} {
|
||||
|
||||
}
|
||||
|
||||
~ScopedTimestampProfile() {
|
||||
log_write("\t[%s] time taken: %.2fs %.2fms\n", m_name.c_str(), m_ts.GetSecondsD(), m_ts.GetMsD());
|
||||
}
|
||||
|
||||
private:
|
||||
const std::string m_name;
|
||||
TimeStamp m_ts{};
|
||||
};
|
||||
|
||||
#define SCOPED_TIMESTAMP(name) sphaira::utils::ScopedTimestampProfile ANONYMOUS_VARIABLE(SCOPE_PROFILE_STATE_){name};
|
||||
|
||||
} // namespace sphaira::utils
|
||||
Reference in New Issue
Block a user