40 lines
No EOL
1.2 KiB
C++
40 lines
No EOL
1.2 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// File: gear_testing/metrics/perftest.cpp
|
|
// Copyright (c) Ubisoft Entertainment. All rights reserved.
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#if !defined(__SPU__)
|
|
|
|
#include <gear_core/os/thread.h>
|
|
#include <gear_testing/gear_testing.h>
|
|
#include <gear_testing/metrics/perftest.h>
|
|
|
|
namespace G4
|
|
{
|
|
|
|
void PerfTest::SetUp()
|
|
{
|
|
G4::LeechThread leech;
|
|
previousPriority = leech.GetCurrentPriority();
|
|
previousAffinity = leech.GetCurrentAffinity();
|
|
// On some platforms we are not allowed to change the main thread affinity (ex: OSPanic happen)
|
|
#if G4_PLATFORM != G4_PLATFORM_CAFE && G4_PLATFORM != G4_PLATFORM_LINUX && !G4_PLATFORM_APPLE
|
|
leech.SetAffinity(Thread::NoAffinity);
|
|
#endif
|
|
leech.SetPriority(G4_HW_PRIORITY_TIME_CRITICAL);
|
|
}
|
|
|
|
void PerfTest::TearDown()
|
|
{
|
|
G4::LeechThread leech;
|
|
leech.SetPriority(previousPriority);
|
|
#if G4_PLATFORM != G4_PLATFORM_CAFE && G4_PLATFORM != G4_PLATFORM_LINUX && !G4_PLATFORM_APPLE
|
|
leech.SetAffinity(previousAffinity);
|
|
#endif
|
|
}
|
|
|
|
}
|
|
|
|
#endif |