ncm install task: implement IncrementProgress and update UpdateThroughputMeasurement

This commit is contained in:
Adubbz 2020-03-16 23:04:15 +11:00 committed by Michael Scire
parent d90004efb7
commit 6d8f4957c8
2 changed files with 7 additions and 1 deletions

View file

@ -66,6 +66,7 @@ PrepareContentMeta (both), WritePlaceHolderBuffer, Get/Delete InstallContentMeta
void ResetThroughputMeasurement();
void SetProgressState(InstallProgressState state);
void IncrementProgress(s64 size);
void UpdateThroughputMeasurement(s64 throughput);
bool IsNecessaryInstallTicket(const fs::RightsId &rights_id);
void SetTotalSize(s64 size);

View file

@ -414,12 +414,17 @@ namespace ams::ncm {
/* ... */
void InstallTaskBase::IncrementProgress(s64 size) {
std::scoped_lock lk(this->progress_mutex);
this->progress.installed_size += size;
}
void InstallTaskBase::UpdateThroughputMeasurement(s64 throughput) {
std::scoped_lock lk(this->throughput_mutex);
if (this->throughput_start_time.GetNanoSeconds() != 0) {
this->throughput.installed += throughput;
/* TODO. */
this->throughput.elapsed_time = os::ConvertToTimeSpan(os::GetSystemTick()) - this->throughput_start_time;
}
}