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/273595
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2015-05-27 12:50:55 -07:00
parent 774c66f37e
commit 3c85635de1
6 changed files with 19 additions and 4 deletions

View File

@@ -1056,6 +1056,7 @@
'dependencies':
[
'angle_deqp_libtester',
'<(angle_path)/util/util.gyp:angle_util',
],
'defines':
[
@@ -1075,6 +1076,7 @@
'dependencies':
[
'angle_deqp_libtester',
'<(angle_path)/util/util.gyp:angle_util',
],
'defines':
[

View File

@@ -24,6 +24,7 @@
#include <EGL/eglext.h>
#include "egluGLContextFactory.hpp"
#include "system_utils.h"
#include "tcuANGLEWin32NativeDisplayFactory.h"
#include "tcuNullContextFactory.hpp"
@@ -32,9 +33,7 @@ namespace tcu
ANGLEWin32Platform::ANGLEWin32Platform()
{
// Set process priority to lower.
// TODO(cwallez): add this to utils
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
angle::SetLowPriorityProcess();
#if defined(ANGLE_DEQP_GLES2_TESTS) || defined(ANGLE_DEQP_GLES3_TESTS)
std::vector<eglw::EGLAttrib> d3d11Attribs;

View File

@@ -24,7 +24,6 @@
#include "tcuDefs.hpp"
#include "tcuPlatform.hpp"
#include "gluPlatform.hpp"
#include "tcuWin32API.h"
#ifndef _EGLUPLATFORM_HPP
# include "egluPlatform.hpp"

View File

@@ -8,7 +8,10 @@
#include "system_utils.h"
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <array>
@@ -38,4 +41,9 @@ std::string GetExecutableDirectory()
return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
}
void SetLowPriorityProcess()
{
setpriority(PRIO_PROCESS, getpid(), 10);
}
} // namespace angle

View File

@@ -20,6 +20,8 @@ std::string GetExecutableDirectory();
// Cross platform equivalent of the Windows Sleep function
void Sleep(unsigned int milliseconds);
void SetLowPriorityProcess();
} // namespace angle
#endif // SAMPLE_UTIL_PATH_UTILS_H

View File

@@ -33,4 +33,9 @@ void Sleep(unsigned int milliseconds)
::Sleep(static_cast<DWORD>(milliseconds));
}
void SetLowPriorityProcess()
{
SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);
}
} // namespace angle