From a26b34c20800363ebf6fa660aeb3e806894b7a93 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Tue, 2 Jun 2015 01:14:10 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=81=97=E3=81=9F=E3=83=97?= =?UTF-8?q?=E3=83=AD=E3=82=BB=E3=83=83=E3=82=B5=E3=83=BC=E3=82=92=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/waifu2x.cpp | 2 +- common/waifu2x.h | 2 +- waifu2x-caffe-gui/Source.cpp | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/common/waifu2x.cpp b/common/waifu2x.cpp index 6c71ab5..e6916d8 100644 --- a/common/waifu2x.cpp +++ b/common/waifu2x.cpp @@ -649,7 +649,7 @@ eWaifu2xError waifu2x(int argc, char** argv, const std::vector(InitTime).count() , std::chrono::duration_cast(cuDNNCheckTime).count() - , std::chrono::duration_cast(ProcessTime).count()); + , std::chrono::duration_cast(ProcessTime).count(), process_fix); return eWaifu2xError_OK; } diff --git a/common/waifu2x.h b/common/waifu2x.h index 7d5a154..0f3d546 100644 --- a/common/waifu2x.h +++ b/common/waifu2x.h @@ -23,7 +23,7 @@ typedef std::pair InputOutputPathPair; typedef std::pair PathAndErrorPair; typedef std::function waifu2xCancelFunc; typedef std::function waifu2xProgressFunc; -typedef std::function waifu2xTimeFunc; +typedef std::function waifu2xTimeFunc; bool can_use_cuDNN(); diff --git a/waifu2x-caffe-gui/Source.cpp b/waifu2x-caffe-gui/Source.cpp index d805b60..a1b9085 100644 --- a/waifu2x-caffe-gui/Source.cpp +++ b/waifu2x-caffe-gui/Source.cpp @@ -88,6 +88,7 @@ private: uint64_t InitTime; uint64_t cuDNNCheckTime; uint64_t ProcessTime; + std::string Process; }; private: @@ -272,12 +273,13 @@ private: 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; t.InitTime = InitTime; t.cuDNNCheckTime = cuDNNCheckTime; t.ProcessTime = ProcessTime; + t.Process = Process; SendMessage(dh, WM_TIME_WAIFU2X, (WPARAM)&t, 0); }; @@ -372,6 +374,18 @@ public: char msg[1024*2]; 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; const int msec = t % 1000; t /= 1000; @@ -390,6 +404,7 @@ public: ptr += sprintf(ptr, "初期化時間: %02d:%02d:%02d.%d\r\n", hour, min, sec, msec); } + if (tp->Process == "gpu" || tp->Process == "cudnn") { uint64_t t = tp->cuDNNCheckTime; const int msec = t % 1000; t /= 1000;