fs_user: Add a delay for each file open

This commit is contained in:
fearlessTobi
2018-11-02 18:11:22 +01:00
parent d0de727a97
commit fc7e6c9cc9
14 changed files with 153 additions and 11 deletions

View File

@ -31,6 +31,13 @@ class IVFCDelayGenerator : public DelayGenerator {
u64 IPCDelayNanoseconds = std::max<u64>(static_cast<u64>(length) * slope + offset, minimum);
return IPCDelayNanoseconds;
}
u64 GetOpenDelayNs() override {
// This is the delay measured for a romfs open.
// For now we will take that as a default
static constexpr u64 IPCDelayNanoseconds(9438006);
return IPCDelayNanoseconds;
}
};
class RomFSDelayGenerator : public DelayGenerator {
@ -45,6 +52,14 @@ public:
u64 IPCDelayNanoseconds = std::max<u64>(static_cast<u64>(length) * slope + offset, minimum);
return IPCDelayNanoseconds;
}
u64 GetOpenDelayNs() override {
// This is the delay measured on O3DS and O2DS with
// https://gist.github.com/FearlessTobi/eb1d70619c65c7e6f02141d71e79a36e
// from the results the average of each length was taken.
static constexpr u64 IPCDelayNanoseconds(9438006);
return IPCDelayNanoseconds;
}
};
class ExeFSDelayGenerator : public DelayGenerator {
@ -59,6 +74,14 @@ public:
u64 IPCDelayNanoseconds = std::max<u64>(static_cast<u64>(length) * slope + offset, minimum);
return IPCDelayNanoseconds;
}
u64 GetOpenDelayNs() override {
// This is the delay measured on O3DS and O2DS with
// https://gist.github.com/FearlessTobi/eb1d70619c65c7e6f02141d71e79a36e
// from the results the average of each length was taken.
static constexpr u64 IPCDelayNanoseconds(9438006);
return IPCDelayNanoseconds;
}
};
/**
@ -68,7 +91,8 @@ public:
*/
class IVFCArchive : public ArchiveBackend {
public:
IVFCArchive(std::shared_ptr<RomFSReader> file);
IVFCArchive(std::shared_ptr<RomFSReader> file,
std::unique_ptr<DelayGenerator> delay_generator_);
std::string GetName() const override;