Commit 3c85635d by Corentin Wallez

Add SetLowPriorityProcess to utils and use it in dEQP support

This provides a cross-platform way to make sure dEQP runs in a low priority process. BUG=angleproject:892 Change-Id: I0d12f1eacb78be43edcdb6622f945734c0b377ff Reviewed-on: https://chromium-review.googlesource.com/273595Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 774c66f3
...@@ -1056,6 +1056,7 @@ ...@@ -1056,6 +1056,7 @@
'dependencies': 'dependencies':
[ [
'angle_deqp_libtester', 'angle_deqp_libtester',
'<(angle_path)/util/util.gyp:angle_util',
], ],
'defines': 'defines':
[ [
...@@ -1075,6 +1076,7 @@ ...@@ -1075,6 +1076,7 @@
'dependencies': 'dependencies':
[ [
'angle_deqp_libtester', 'angle_deqp_libtester',
'<(angle_path)/util/util.gyp:angle_util',
], ],
'defines': 'defines':
[ [
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include "egluGLContextFactory.hpp" #include "egluGLContextFactory.hpp"
#include "system_utils.h"
#include "tcuANGLEWin32NativeDisplayFactory.h" #include "tcuANGLEWin32NativeDisplayFactory.h"
#include "tcuNullContextFactory.hpp" #include "tcuNullContextFactory.hpp"
...@@ -32,9 +33,7 @@ namespace tcu ...@@ -32,9 +33,7 @@ namespace tcu
ANGLEWin32Platform::ANGLEWin32Platform() ANGLEWin32Platform::ANGLEWin32Platform()
{ {
// Set process priority to lower. angle::SetLowPriorityProcess();
// TODO(cwallez): add this to utils
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
#if defined(ANGLE_DEQP_GLES2_TESTS) || defined(ANGLE_DEQP_GLES3_TESTS) #if defined(ANGLE_DEQP_GLES2_TESTS) || defined(ANGLE_DEQP_GLES3_TESTS)
std::vector<eglw::EGLAttrib> d3d11Attribs; std::vector<eglw::EGLAttrib> d3d11Attribs;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "tcuDefs.hpp" #include "tcuDefs.hpp"
#include "tcuPlatform.hpp" #include "tcuPlatform.hpp"
#include "gluPlatform.hpp" #include "gluPlatform.hpp"
#include "tcuWin32API.h"
#ifndef _EGLUPLATFORM_HPP #ifndef _EGLUPLATFORM_HPP
# include "egluPlatform.hpp" # include "egluPlatform.hpp"
......
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
#include "system_utils.h" #include "system_utils.h"
#include <sys/resource.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <array> #include <array>
...@@ -38,4 +41,9 @@ std::string GetExecutableDirectory() ...@@ -38,4 +41,9 @@ std::string GetExecutableDirectory()
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : ""; return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
} }
void SetLowPriorityProcess()
{
setpriority(PRIO_PROCESS, getpid(), 10);
}
} // namespace angle } // namespace angle
...@@ -20,6 +20,8 @@ std::string GetExecutableDirectory(); ...@@ -20,6 +20,8 @@ std::string GetExecutableDirectory();
// Cross platform equivalent of the Windows Sleep function // Cross platform equivalent of the Windows Sleep function
void Sleep(unsigned int milliseconds); void Sleep(unsigned int milliseconds);
void SetLowPriorityProcess();
} // namespace angle } // namespace angle
#endif // SAMPLE_UTIL_PATH_UTILS_H #endif // SAMPLE_UTIL_PATH_UTILS_H
...@@ -33,4 +33,9 @@ void Sleep(unsigned int milliseconds) ...@@ -33,4 +33,9 @@ void Sleep(unsigned int milliseconds)
::Sleep(static_cast<DWORD>(milliseconds)); ::Sleep(static_cast<DWORD>(milliseconds));
} }
void SetLowPriorityProcess()
{
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
}
} // namespace angle } // namespace angle
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment