使用したプロセッサーを表示するようにした

This commit is contained in:
lltcggie 2015-06-02 01:14:10 +09:00
parent 4a11a7bb63
commit a26b34c208
3 changed files with 18 additions and 3 deletions

View File

@ -649,7 +649,7 @@ eWaifu2xError waifu2x(int argc, char** argv, const std::vector<InputOutputPathPa
if (time_func) if (time_func)
time_func(std::chrono::duration_cast<std::chrono::milliseconds>(InitTime).count() time_func(std::chrono::duration_cast<std::chrono::milliseconds>(InitTime).count()
, std::chrono::duration_cast<std::chrono::milliseconds>(cuDNNCheckTime).count() , std::chrono::duration_cast<std::chrono::milliseconds>(cuDNNCheckTime).count()
, std::chrono::duration_cast<std::chrono::milliseconds>(ProcessTime).count()); , std::chrono::duration_cast<std::chrono::milliseconds>(ProcessTime).count(), process_fix);
return eWaifu2xError_OK; return eWaifu2xError_OK;
} }

View File

@ -23,7 +23,7 @@ typedef std::pair<std::string, std::string> InputOutputPathPair;
typedef std::pair<InputOutputPathPair, eWaifu2xError> PathAndErrorPair; typedef std::pair<InputOutputPathPair, eWaifu2xError> PathAndErrorPair;
typedef std::function<bool()> waifu2xCancelFunc; typedef std::function<bool()> waifu2xCancelFunc;
typedef std::function<void(const int ProgressFileMax, const int ProgressFileNow)> waifu2xProgressFunc; typedef std::function<void(const int ProgressFileMax, const int ProgressFileNow)> waifu2xProgressFunc;
typedef std::function<void(const uint64_t InitTime, const uint64_t cuDNNCheckTime, const uint64_t ProcessTime)> waifu2xTimeFunc; typedef std::function<void(const uint64_t InitTime, const uint64_t cuDNNCheckTime, const uint64_t ProcessTime, const std::string &Process)> waifu2xTimeFunc;
bool can_use_cuDNN(); bool can_use_cuDNN();

View File

@ -88,6 +88,7 @@ private:
uint64_t InitTime; uint64_t InitTime;
uint64_t cuDNNCheckTime; uint64_t cuDNNCheckTime;
uint64_t ProcessTime; uint64_t ProcessTime;
std::string Process;
}; };
private: private:
@ -272,12 +273,13 @@ private:
SendMessage(GetDlgItem(dh, IDC_PROGRESS), PBM_SETPOS, ProgressFileNow, 0); SendMessage(GetDlgItem(dh, IDC_PROGRESS), PBM_SETPOS, ProgressFileNow, 0);
}; };
const auto TimeFunc = [this](const uint64_t InitTime, const uint64_t cuDNNCheckTime, const uint64_t ProcessTime) const auto TimeFunc = [this](const uint64_t InitTime, const uint64_t cuDNNCheckTime, const uint64_t ProcessTime, const std::string &Process)
{ {
stWaifu2xTime t; stWaifu2xTime t;
t.InitTime = InitTime; t.InitTime = InitTime;
t.cuDNNCheckTime = cuDNNCheckTime; t.cuDNNCheckTime = cuDNNCheckTime;
t.ProcessTime = ProcessTime; t.ProcessTime = ProcessTime;
t.Process = Process;
SendMessage(dh, WM_TIME_WAIFU2X, (WPARAM)&t, 0); SendMessage(dh, WM_TIME_WAIFU2X, (WPARAM)&t, 0);
}; };
@ -372,6 +374,18 @@ public:
char msg[1024*2]; char msg[1024*2];
char *ptr = msg; char *ptr = msg;
{
std::string p(tp->Process);
if (p == "cpu")
p = "CPU";
else if (p == "gpu")
p = "GPU";
else if (p == "cudnn")
p = "cuDNN";
ptr += sprintf(ptr, "使用プロセッサーモード: %s\r\n", p.c_str());
}
{ {
uint64_t t = tp->ProcessTime; uint64_t t = tp->ProcessTime;
const int msec = t % 1000; t /= 1000; const int msec = t % 1000; t /= 1000;
@ -390,6 +404,7 @@ public:
ptr += sprintf(ptr, "<EFBFBD>‰Šú‰»ŽžŠÔ: %02d:%02d:%02d.%d\r\n", hour, min, sec, msec); ptr += sprintf(ptr, "<EFBFBD>‰Šú‰»ŽžŠÔ: %02d:%02d:%02d.%d\r\n", hour, min, sec, msec);
} }
if (tp->Process == "gpu" || tp->Process == "cudnn")
{ {
uint64_t t = tp->cuDNNCheckTime; uint64_t t = tp->cuDNNCheckTime;
const int msec = t % 1000; t /= 1000; const int msec = t % 1000; t /= 1000;