!F (Profiling) (DEV-7030) Rewrite of the profiling system to have a unified interface...
[CRYENGINE.git] / Code / CryEngine / CrySystem / Profiling / CryProfilingSystemSharedImpl.cpp
blob28674f138b2d86b8742343f61c7119c395726284
1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
3 #include "StdAfx.h"
4 #include "CryProfilingSystemSharedImpl.h"
5 #include <CryCore/CryCrc32.h>
7 CCryProfilingSystemImpl::CCryProfilingSystemImpl()
8 {}
10 bool CCryProfilingSystemImpl::OnInputEvent(const SInputEvent& event)
12 if (event.deviceType == eIDT_Keyboard && event.keyId == eKI_ScrollLock)
14 if (event.state == eIS_Pressed)
16 PauseRecording(!IsPaused());
19 return false;
22 void CCryProfilingSystemImpl::OnSliceAndSleep()
24 EndFrame();
25 StartFrame();
28 const char* CCryProfilingSystemImpl::GetModuleName(EProfiledSubsystem subSystem) const
30 switch (subSystem)
32 case PROFILE_RENDERER:
33 return "Renderer";
34 case PROFILE_3DENGINE:
35 return "3DEngine";
36 case PROFILE_PARTICLE:
37 return "Particles";
38 case PROFILE_AI:
39 return "AI";
40 case PROFILE_ANIMATION:
41 return "Animation";
42 case PROFILE_MOVIE:
43 return "Movie";
44 case PROFILE_ENTITY:
45 return "Entities";
46 case PROFILE_FONT:
47 return "Font";
48 case PROFILE_NETWORK:
49 return "Network";
50 case PROFILE_PHYSICS:
51 return "Physics";
52 case PROFILE_SCRIPT:
53 return "Script";
54 case PROFILE_SCRIPT_CFUNC:
55 return "Script_CFunc";
56 case PROFILE_AUDIO:
57 return "Audio";
58 case PROFILE_EDITOR:
59 return "Editor";
60 case PROFILE_SYSTEM:
61 return "System";
62 case PROFILE_ACTION:
63 return "Action";
64 case PROFILE_GAME:
65 return "Game";
66 case PROFILE_INPUT:
67 return "Input";
68 case PROFILE_LOADING_ONLY:
69 return "Loading";
70 default:
71 assert(false);
72 return "<Unknown Id>";
76 const char* CCryProfilingSystemImpl::GetModuleName(const SProfilingSection* pSection) const
78 return GetModuleName(pSection->pDescription->subsystem);
81 uint32 CCryProfilingSystemImpl::GenerateColorBasedOnName(const char* name)
83 uint32 hash = CCrc32::Compute(name);
84 hash |= 0xFF000000; // force alpha to opaque
85 return hash;