mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Fix line endings and tabs
This commit is contained in:
@ -1,24 +1,24 @@
|
||||
include_directories("../../CoreLib")
|
||||
include_directories("../../NucleusLib/inc")
|
||||
include_directories("../../NucleusLib")
|
||||
include_directories("../../PubUtilLib")
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
set(plStatGather_SOURCES
|
||||
plAutoProfile.cpp
|
||||
plCalculatedProfiles.cpp
|
||||
plProfileManagerFull.cpp
|
||||
)
|
||||
|
||||
set(plStatGather_HEADERS
|
||||
plAutoProfile.h
|
||||
plCalculatedProfiles.h
|
||||
plProfileManagerFull.h
|
||||
plStatGatherCreatable.h
|
||||
)
|
||||
|
||||
add_library(plStatGather STATIC ${plStatGather_SOURCES} ${plStatGather_HEADERS})
|
||||
|
||||
source_group("Source Files" FILES ${plStatGather_SOURCES})
|
||||
source_group("Header Files" FILES ${plStatGather_HEADERS})
|
||||
include_directories("../../CoreLib")
|
||||
include_directories("../../NucleusLib/inc")
|
||||
include_directories("../../NucleusLib")
|
||||
include_directories("../../PubUtilLib")
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
set(plStatGather_SOURCES
|
||||
plAutoProfile.cpp
|
||||
plCalculatedProfiles.cpp
|
||||
plProfileManagerFull.cpp
|
||||
)
|
||||
|
||||
set(plStatGather_HEADERS
|
||||
plAutoProfile.h
|
||||
plCalculatedProfiles.h
|
||||
plProfileManagerFull.h
|
||||
plStatGatherCreatable.h
|
||||
)
|
||||
|
||||
add_library(plStatGather STATIC ${plStatGather_SOURCES} ${plStatGather_HEADERS})
|
||||
|
||||
source_group("Source Files" FILES ${plStatGather_SOURCES})
|
||||
source_group("Header Files" FILES ${plStatGather_HEADERS})
|
||||
|
@ -1,383 +1,383 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plAutoProfile.h"
|
||||
|
||||
#include "plgDispatch.h"
|
||||
#include "plNetClient/plNetClientMgr.h"
|
||||
#include "plNetClient/plNetLinkingMgr.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
#include "hsTimer.h"
|
||||
#include "plMessage/plAgeLoadedMsg.h"
|
||||
#include "pnTimer/plTimerCallbackManager.h"
|
||||
#include "plMessage/plTimerCallbackMsg.h"
|
||||
#include "plAvatar/plAvatarMgr.h"
|
||||
#include "plAvatar/plArmatureMod.h"
|
||||
#include "plModifier/plSpawnModifier.h"
|
||||
#include "plMessage/plConsoleMsg.h"
|
||||
#include "pnMessage/plClientMsg.h"
|
||||
#include "plAgeLoader/plAgeLoader.h"
|
||||
#include "plProfileManagerFull.h"
|
||||
#include "plFile/plFileUtils.h"
|
||||
|
||||
#include "plPipeline/plDebugText.h"
|
||||
#include "pnMessage/plTimeMsg.h"
|
||||
|
||||
#include "plStatusLog/plStatusLog.h"
|
||||
#include "plVault/plVault.h"
|
||||
|
||||
#include "plContainer/plConfigInfo.h" // for plStringList
|
||||
|
||||
// For taking screenshots
|
||||
#include "plGImage/plMipmap.h"
|
||||
#include "../../Apps/plClient/plClient.h"
|
||||
#include "plJPEG/plJPEG.h"
|
||||
#include "plPipeline.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
class plAutoProfileImp : public plAutoProfile
|
||||
{
|
||||
protected:
|
||||
plStringList fAges;
|
||||
int fNextAge;
|
||||
int fNextSpawnPoint;
|
||||
const char* fLastSpawnPointName;
|
||||
// For profiling a single age
|
||||
std::string fAgeName;
|
||||
bool fLinkedToSingleAge;
|
||||
bool fJustLinkToAges;
|
||||
|
||||
UInt64 fLinkTime;
|
||||
|
||||
std::string fStatusMessage;
|
||||
|
||||
void INextProfile();
|
||||
bool INextAge();
|
||||
bool INextSpawnPoint();
|
||||
|
||||
void IInit();
|
||||
void IShutdown();
|
||||
|
||||
public:
|
||||
plAutoProfileImp();
|
||||
|
||||
virtual void StartProfile(const char* ageName);
|
||||
virtual void LinkToAllAges();
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
};
|
||||
|
||||
plAutoProfile* plAutoProfile::Instance()
|
||||
{
|
||||
static plAutoProfileImp theInstance;
|
||||
return &theInstance;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
plAutoProfileImp::plAutoProfileImp() : fNextAge(0), fNextSpawnPoint(0), fLastSpawnPointName(nil), fLinkedToSingleAge(false), fJustLinkToAges(false)
|
||||
{
|
||||
}
|
||||
|
||||
void plAutoProfileImp::StartProfile(const char* ageName)
|
||||
{
|
||||
if (ageName)
|
||||
fAgeName = ageName;
|
||||
else
|
||||
fAgeName = "";
|
||||
|
||||
IInit();
|
||||
|
||||
plProfileManagerFull::Instance().ActivateAllStats();
|
||||
}
|
||||
|
||||
void plAutoProfileImp::LinkToAllAges()
|
||||
{
|
||||
fJustLinkToAges = true;
|
||||
IInit();
|
||||
}
|
||||
|
||||
void plAutoProfileImp::IInit()
|
||||
{
|
||||
// TODO: Find a better way to grab a list of age names, since the old data server
|
||||
// no longer exists
|
||||
/*plIDataServer* dataServer = plNetClientMgr::GetInstance()->GetDataServer();
|
||||
if (!dataServer)
|
||||
return;
|
||||
|
||||
dataServer->GetDatasetAges(fAges);*/
|
||||
|
||||
// The first age we link into is AvatarCustomization, since we have a new avatar.
|
||||
// Coincidentally, the first age in our list is AvatarCustomization. However,
|
||||
// sometimes linking from ACA to ACA causes a crash. To get around that, we just
|
||||
// reverse the list, so it's last.
|
||||
std::reverse(fAges.begin(), fAges.end());
|
||||
|
||||
fNextAge = 0;
|
||||
|
||||
RegisterAs(kAutoProfile_KEY);
|
||||
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plAgeBeginLoadingMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plInitialAgeStateLoadedMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
|
||||
|
||||
plConsoleMsg* consoleMsg = TRACKED_NEW plConsoleMsg(plConsoleMsg::kExecuteLine, "Camera.AlwaysCut true");
|
||||
consoleMsg->Send();
|
||||
}
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
#include "hsWindows.h"
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
void plAutoProfileImp::IShutdown()
|
||||
{
|
||||
// KLUDGE - Copy the load timing log, in case we used it
|
||||
#define kTimingLog L"readtimings.0.log"
|
||||
#define kAgeTimingLog L"agetimings.0.log"
|
||||
wchar destPath[MAX_PATH];
|
||||
wchar sourcePath[MAX_PATH];
|
||||
|
||||
PathAddFilename(destPath, plProfileManagerFull::Instance().GetProfilePath(), kTimingLog, arrsize(destPath));
|
||||
PathGetLogDirectory(sourcePath, arrsize(sourcePath));
|
||||
PathAddFilename(sourcePath, sourcePath, kTimingLog, arrsize(sourcePath));
|
||||
plFileUtils::FileCopy(sourcePath, destPath);
|
||||
|
||||
PathAddFilename(destPath, plProfileManagerFull::Instance().GetProfilePath(), kAgeTimingLog, arrsize(destPath));
|
||||
PathGetLogDirectory(sourcePath, arrsize(sourcePath));
|
||||
PathAddFilename(sourcePath, sourcePath, kAgeTimingLog, arrsize(sourcePath));
|
||||
plFileUtils::FileCopy(sourcePath, destPath);
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
ShellExecute(nil, nil, "PostRun.bat", nil, nil, SW_SHOWNORMAL);
|
||||
#endif
|
||||
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plInitialAgeStateLoadedMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plAgeLoadedMsg::Index(), GetKey());
|
||||
|
||||
UnRegisterAs(kAutoProfile_KEY);
|
||||
// Pump the queue so we get fully unregistered
|
||||
plgDispatch::Dispatch()->MsgQueueProcess();
|
||||
|
||||
plClientMsg* clientMsg = TRACKED_NEW plClientMsg(plClientMsg::kQuit);
|
||||
clientMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY));
|
||||
}
|
||||
|
||||
void plAutoProfileImp::INextProfile()
|
||||
{
|
||||
// Haven't linked to our first age yet, do that before we start profiling
|
||||
if (fNextAge == 0)
|
||||
{
|
||||
if (!INextAge())
|
||||
IShutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Log the stats for this spawn point
|
||||
if (fLastSpawnPointName)
|
||||
{
|
||||
const char * ageName = NetCommGetAge()->ageDatasetName;
|
||||
plProfileManagerFull::Instance().LogStats(ageName, fLastSpawnPointName);
|
||||
|
||||
plMipmap mipmap;
|
||||
if (plClient::GetInstance()->GetPipeline()->CaptureScreen(&mipmap))
|
||||
{
|
||||
char fileName[256];
|
||||
sprintf(fileName, "%s%s_%s.jpg",
|
||||
plProfileManagerFull::Instance().GetProfilePath(),
|
||||
ageName, fLastSpawnPointName);
|
||||
|
||||
plJPEG::Instance().SetWriteQuality(100);
|
||||
plJPEG::Instance().WriteToFile(fileName, &mipmap);
|
||||
}
|
||||
|
||||
fLastSpawnPointName = nil;
|
||||
}
|
||||
|
||||
// Try to go to the next spawn point
|
||||
if (!INextSpawnPoint())
|
||||
{
|
||||
// Link to the next age
|
||||
if (!INextAge())
|
||||
{
|
||||
// We've done all the ages, shut down
|
||||
IShutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool plAutoProfileImp::INextAge()
|
||||
{
|
||||
const char* ageName = nil;
|
||||
|
||||
if (fAgeName.length() > 0)
|
||||
{
|
||||
if (fLinkedToSingleAge)
|
||||
return false;
|
||||
|
||||
fLinkedToSingleAge = true;
|
||||
ageName = fAgeName.c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fNextAge >= fAges.size())
|
||||
return false;
|
||||
|
||||
ageName = fAges[fNextAge].c_str();
|
||||
}
|
||||
|
||||
fNextAge++;
|
||||
fNextSpawnPoint = 0;
|
||||
|
||||
plAgeLinkStruct link;
|
||||
link.GetAgeInfo()->SetAgeFilename(ageName);
|
||||
link.SetLinkingRules(plNetCommon::LinkingRules::kBasicLink);
|
||||
plNetLinkingMgr::GetInstance()->LinkToAge(&link);
|
||||
|
||||
fStatusMessage = "Linking to age ";
|
||||
fStatusMessage += ageName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool plAutoProfileImp::INextSpawnPoint()
|
||||
{
|
||||
if (fJustLinkToAges)
|
||||
return false;
|
||||
|
||||
const char* kPerfSpawnPrefix = "cPerf-";
|
||||
int kPerfSpawnLen = strlen(kPerfSpawnPrefix);
|
||||
|
||||
// Find the next perf spawn point
|
||||
bool foundGood = false;
|
||||
while (fNextSpawnPoint < plAvatarMgr::GetInstance()->NumSpawnPoints())
|
||||
{
|
||||
const plSpawnModifier* spawnMod = plAvatarMgr::GetInstance()->GetSpawnPoint(fNextSpawnPoint);
|
||||
fLastSpawnPointName = spawnMod->GetKeyName();
|
||||
|
||||
if (strncmp(fLastSpawnPointName, kPerfSpawnPrefix, kPerfSpawnLen) == 0)
|
||||
{
|
||||
fStatusMessage = "Profiling spawn point ";
|
||||
fStatusMessage += fLastSpawnPointName;
|
||||
|
||||
foundGood = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
fNextSpawnPoint++;
|
||||
}
|
||||
|
||||
if (!foundGood)
|
||||
{
|
||||
fLastSpawnPointName = nil;
|
||||
fStatusMessage = "No profile spawn point found";
|
||||
return false;
|
||||
}
|
||||
|
||||
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
if (avatar)
|
||||
{
|
||||
double fakeTime = 0.0f;
|
||||
avatar->SpawnAt(fNextSpawnPoint, fakeTime);
|
||||
}
|
||||
|
||||
fNextSpawnPoint++;
|
||||
|
||||
plTimerCallbackMsg* timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey());
|
||||
plgTimerCallbackMgr::NewTimer(30, timerMsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plAutoProfileImp::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plEvalMsg* evalMsg = plEvalMsg::ConvertNoRef(msg);
|
||||
if (evalMsg)
|
||||
{
|
||||
if (fStatusMessage.length() > 0)
|
||||
plDebugText::Instance().DrawString(10, 10, fStatusMessage.c_str());
|
||||
}
|
||||
|
||||
plAgeLoadedMsg* ageLoaded = plAgeLoadedMsg::ConvertNoRef(msg);
|
||||
if (ageLoaded)
|
||||
{
|
||||
if (!ageLoaded->fLoaded)
|
||||
{
|
||||
fLinkTime = hsTimer::GetFullTickCount();
|
||||
hsStatusMessage("Age unloaded");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
plInitialAgeStateLoadedMsg* ageStateLoaded = plInitialAgeStateLoadedMsg::ConvertNoRef(msg);
|
||||
if (ageStateLoaded)
|
||||
{
|
||||
if (fNextAge > 0)
|
||||
{
|
||||
fLinkTime = hsTimer::GetFullTickCount() - fLinkTime;
|
||||
float ms = hsTimer::FullTicksToMs(fLinkTime);
|
||||
|
||||
hsStatusMessageF("Age %s finished load, took %.1f ms",
|
||||
fAges[fNextAge-1].c_str(),
|
||||
ms);
|
||||
|
||||
plStatusLog::AddLineS("agetimings.log", "Age %s took %.1f ms",
|
||||
fAges[fNextAge-1].c_str(),
|
||||
ms);
|
||||
}
|
||||
|
||||
fStatusMessage = "Age loaded. Preparing to profile.";
|
||||
|
||||
// Age is loaded, start profiling in 5 seconds (to make sure the avatar is linked in all the way)
|
||||
plTimerCallbackMsg* timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey());
|
||||
plgTimerCallbackMgr::NewTimer(5, timerMsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
plTimerCallbackMsg* timerMsg = plTimerCallbackMsg::ConvertNoRef(msg);
|
||||
if (timerMsg)
|
||||
{
|
||||
INextProfile();
|
||||
return true;
|
||||
}
|
||||
|
||||
// When the first age starts to load, register the stupid avatar customization variable
|
||||
// so the calibration screen won't pop up and ruin everything. I'm sure I could try
|
||||
// and do this earlier, but I'm not sure when that player folder is set so screw it, it works here.
|
||||
plAgeBeginLoadingMsg* ageBeginLoadingMsg = plAgeBeginLoadingMsg::ConvertNoRef(msg);
|
||||
if (ageBeginLoadingMsg)
|
||||
{
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plAgeBeginLoadingMsg::Index(), GetKey());
|
||||
VaultAddChronicleEntryAndWait(L"InitialAvCursomizationsDone", 0, L"1");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plAutoProfile.h"
|
||||
|
||||
#include "plgDispatch.h"
|
||||
#include "plNetClient/plNetClientMgr.h"
|
||||
#include "plNetClient/plNetLinkingMgr.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
#include "hsTimer.h"
|
||||
#include "plMessage/plAgeLoadedMsg.h"
|
||||
#include "pnTimer/plTimerCallbackManager.h"
|
||||
#include "plMessage/plTimerCallbackMsg.h"
|
||||
#include "plAvatar/plAvatarMgr.h"
|
||||
#include "plAvatar/plArmatureMod.h"
|
||||
#include "plModifier/plSpawnModifier.h"
|
||||
#include "plMessage/plConsoleMsg.h"
|
||||
#include "pnMessage/plClientMsg.h"
|
||||
#include "plAgeLoader/plAgeLoader.h"
|
||||
#include "plProfileManagerFull.h"
|
||||
#include "plFile/plFileUtils.h"
|
||||
|
||||
#include "plPipeline/plDebugText.h"
|
||||
#include "pnMessage/plTimeMsg.h"
|
||||
|
||||
#include "plStatusLog/plStatusLog.h"
|
||||
#include "plVault/plVault.h"
|
||||
|
||||
#include "plContainer/plConfigInfo.h" // for plStringList
|
||||
|
||||
// For taking screenshots
|
||||
#include "plGImage/plMipmap.h"
|
||||
#include "../../Apps/plClient/plClient.h"
|
||||
#include "plJPEG/plJPEG.h"
|
||||
#include "plPipeline.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
class plAutoProfileImp : public plAutoProfile
|
||||
{
|
||||
protected:
|
||||
plStringList fAges;
|
||||
int fNextAge;
|
||||
int fNextSpawnPoint;
|
||||
const char* fLastSpawnPointName;
|
||||
// For profiling a single age
|
||||
std::string fAgeName;
|
||||
bool fLinkedToSingleAge;
|
||||
bool fJustLinkToAges;
|
||||
|
||||
UInt64 fLinkTime;
|
||||
|
||||
std::string fStatusMessage;
|
||||
|
||||
void INextProfile();
|
||||
bool INextAge();
|
||||
bool INextSpawnPoint();
|
||||
|
||||
void IInit();
|
||||
void IShutdown();
|
||||
|
||||
public:
|
||||
plAutoProfileImp();
|
||||
|
||||
virtual void StartProfile(const char* ageName);
|
||||
virtual void LinkToAllAges();
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
};
|
||||
|
||||
plAutoProfile* plAutoProfile::Instance()
|
||||
{
|
||||
static plAutoProfileImp theInstance;
|
||||
return &theInstance;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
plAutoProfileImp::plAutoProfileImp() : fNextAge(0), fNextSpawnPoint(0), fLastSpawnPointName(nil), fLinkedToSingleAge(false), fJustLinkToAges(false)
|
||||
{
|
||||
}
|
||||
|
||||
void plAutoProfileImp::StartProfile(const char* ageName)
|
||||
{
|
||||
if (ageName)
|
||||
fAgeName = ageName;
|
||||
else
|
||||
fAgeName = "";
|
||||
|
||||
IInit();
|
||||
|
||||
plProfileManagerFull::Instance().ActivateAllStats();
|
||||
}
|
||||
|
||||
void plAutoProfileImp::LinkToAllAges()
|
||||
{
|
||||
fJustLinkToAges = true;
|
||||
IInit();
|
||||
}
|
||||
|
||||
void plAutoProfileImp::IInit()
|
||||
{
|
||||
// TODO: Find a better way to grab a list of age names, since the old data server
|
||||
// no longer exists
|
||||
/*plIDataServer* dataServer = plNetClientMgr::GetInstance()->GetDataServer();
|
||||
if (!dataServer)
|
||||
return;
|
||||
|
||||
dataServer->GetDatasetAges(fAges);*/
|
||||
|
||||
// The first age we link into is AvatarCustomization, since we have a new avatar.
|
||||
// Coincidentally, the first age in our list is AvatarCustomization. However,
|
||||
// sometimes linking from ACA to ACA causes a crash. To get around that, we just
|
||||
// reverse the list, so it's last.
|
||||
std::reverse(fAges.begin(), fAges.end());
|
||||
|
||||
fNextAge = 0;
|
||||
|
||||
RegisterAs(kAutoProfile_KEY);
|
||||
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plAgeBeginLoadingMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plInitialAgeStateLoadedMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
|
||||
|
||||
plConsoleMsg* consoleMsg = TRACKED_NEW plConsoleMsg(plConsoleMsg::kExecuteLine, "Camera.AlwaysCut true");
|
||||
consoleMsg->Send();
|
||||
}
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
#include "hsWindows.h"
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
void plAutoProfileImp::IShutdown()
|
||||
{
|
||||
// KLUDGE - Copy the load timing log, in case we used it
|
||||
#define kTimingLog L"readtimings.0.log"
|
||||
#define kAgeTimingLog L"agetimings.0.log"
|
||||
wchar destPath[MAX_PATH];
|
||||
wchar sourcePath[MAX_PATH];
|
||||
|
||||
PathAddFilename(destPath, plProfileManagerFull::Instance().GetProfilePath(), kTimingLog, arrsize(destPath));
|
||||
PathGetLogDirectory(sourcePath, arrsize(sourcePath));
|
||||
PathAddFilename(sourcePath, sourcePath, kTimingLog, arrsize(sourcePath));
|
||||
plFileUtils::FileCopy(sourcePath, destPath);
|
||||
|
||||
PathAddFilename(destPath, plProfileManagerFull::Instance().GetProfilePath(), kAgeTimingLog, arrsize(destPath));
|
||||
PathGetLogDirectory(sourcePath, arrsize(sourcePath));
|
||||
PathAddFilename(sourcePath, sourcePath, kAgeTimingLog, arrsize(sourcePath));
|
||||
plFileUtils::FileCopy(sourcePath, destPath);
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
ShellExecute(nil, nil, "PostRun.bat", nil, nil, SW_SHOWNORMAL);
|
||||
#endif
|
||||
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plInitialAgeStateLoadedMsg::Index(), GetKey());
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plAgeLoadedMsg::Index(), GetKey());
|
||||
|
||||
UnRegisterAs(kAutoProfile_KEY);
|
||||
// Pump the queue so we get fully unregistered
|
||||
plgDispatch::Dispatch()->MsgQueueProcess();
|
||||
|
||||
plClientMsg* clientMsg = TRACKED_NEW plClientMsg(plClientMsg::kQuit);
|
||||
clientMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY));
|
||||
}
|
||||
|
||||
void plAutoProfileImp::INextProfile()
|
||||
{
|
||||
// Haven't linked to our first age yet, do that before we start profiling
|
||||
if (fNextAge == 0)
|
||||
{
|
||||
if (!INextAge())
|
||||
IShutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Log the stats for this spawn point
|
||||
if (fLastSpawnPointName)
|
||||
{
|
||||
const char * ageName = NetCommGetAge()->ageDatasetName;
|
||||
plProfileManagerFull::Instance().LogStats(ageName, fLastSpawnPointName);
|
||||
|
||||
plMipmap mipmap;
|
||||
if (plClient::GetInstance()->GetPipeline()->CaptureScreen(&mipmap))
|
||||
{
|
||||
char fileName[256];
|
||||
sprintf(fileName, "%s%s_%s.jpg",
|
||||
plProfileManagerFull::Instance().GetProfilePath(),
|
||||
ageName, fLastSpawnPointName);
|
||||
|
||||
plJPEG::Instance().SetWriteQuality(100);
|
||||
plJPEG::Instance().WriteToFile(fileName, &mipmap);
|
||||
}
|
||||
|
||||
fLastSpawnPointName = nil;
|
||||
}
|
||||
|
||||
// Try to go to the next spawn point
|
||||
if (!INextSpawnPoint())
|
||||
{
|
||||
// Link to the next age
|
||||
if (!INextAge())
|
||||
{
|
||||
// We've done all the ages, shut down
|
||||
IShutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool plAutoProfileImp::INextAge()
|
||||
{
|
||||
const char* ageName = nil;
|
||||
|
||||
if (fAgeName.length() > 0)
|
||||
{
|
||||
if (fLinkedToSingleAge)
|
||||
return false;
|
||||
|
||||
fLinkedToSingleAge = true;
|
||||
ageName = fAgeName.c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fNextAge >= fAges.size())
|
||||
return false;
|
||||
|
||||
ageName = fAges[fNextAge].c_str();
|
||||
}
|
||||
|
||||
fNextAge++;
|
||||
fNextSpawnPoint = 0;
|
||||
|
||||
plAgeLinkStruct link;
|
||||
link.GetAgeInfo()->SetAgeFilename(ageName);
|
||||
link.SetLinkingRules(plNetCommon::LinkingRules::kBasicLink);
|
||||
plNetLinkingMgr::GetInstance()->LinkToAge(&link);
|
||||
|
||||
fStatusMessage = "Linking to age ";
|
||||
fStatusMessage += ageName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool plAutoProfileImp::INextSpawnPoint()
|
||||
{
|
||||
if (fJustLinkToAges)
|
||||
return false;
|
||||
|
||||
const char* kPerfSpawnPrefix = "cPerf-";
|
||||
int kPerfSpawnLen = strlen(kPerfSpawnPrefix);
|
||||
|
||||
// Find the next perf spawn point
|
||||
bool foundGood = false;
|
||||
while (fNextSpawnPoint < plAvatarMgr::GetInstance()->NumSpawnPoints())
|
||||
{
|
||||
const plSpawnModifier* spawnMod = plAvatarMgr::GetInstance()->GetSpawnPoint(fNextSpawnPoint);
|
||||
fLastSpawnPointName = spawnMod->GetKeyName();
|
||||
|
||||
if (strncmp(fLastSpawnPointName, kPerfSpawnPrefix, kPerfSpawnLen) == 0)
|
||||
{
|
||||
fStatusMessage = "Profiling spawn point ";
|
||||
fStatusMessage += fLastSpawnPointName;
|
||||
|
||||
foundGood = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
fNextSpawnPoint++;
|
||||
}
|
||||
|
||||
if (!foundGood)
|
||||
{
|
||||
fLastSpawnPointName = nil;
|
||||
fStatusMessage = "No profile spawn point found";
|
||||
return false;
|
||||
}
|
||||
|
||||
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
if (avatar)
|
||||
{
|
||||
double fakeTime = 0.0f;
|
||||
avatar->SpawnAt(fNextSpawnPoint, fakeTime);
|
||||
}
|
||||
|
||||
fNextSpawnPoint++;
|
||||
|
||||
plTimerCallbackMsg* timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey());
|
||||
plgTimerCallbackMgr::NewTimer(30, timerMsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plAutoProfileImp::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plEvalMsg* evalMsg = plEvalMsg::ConvertNoRef(msg);
|
||||
if (evalMsg)
|
||||
{
|
||||
if (fStatusMessage.length() > 0)
|
||||
plDebugText::Instance().DrawString(10, 10, fStatusMessage.c_str());
|
||||
}
|
||||
|
||||
plAgeLoadedMsg* ageLoaded = plAgeLoadedMsg::ConvertNoRef(msg);
|
||||
if (ageLoaded)
|
||||
{
|
||||
if (!ageLoaded->fLoaded)
|
||||
{
|
||||
fLinkTime = hsTimer::GetFullTickCount();
|
||||
hsStatusMessage("Age unloaded");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
plInitialAgeStateLoadedMsg* ageStateLoaded = plInitialAgeStateLoadedMsg::ConvertNoRef(msg);
|
||||
if (ageStateLoaded)
|
||||
{
|
||||
if (fNextAge > 0)
|
||||
{
|
||||
fLinkTime = hsTimer::GetFullTickCount() - fLinkTime;
|
||||
float ms = hsTimer::FullTicksToMs(fLinkTime);
|
||||
|
||||
hsStatusMessageF("Age %s finished load, took %.1f ms",
|
||||
fAges[fNextAge-1].c_str(),
|
||||
ms);
|
||||
|
||||
plStatusLog::AddLineS("agetimings.log", "Age %s took %.1f ms",
|
||||
fAges[fNextAge-1].c_str(),
|
||||
ms);
|
||||
}
|
||||
|
||||
fStatusMessage = "Age loaded. Preparing to profile.";
|
||||
|
||||
// Age is loaded, start profiling in 5 seconds (to make sure the avatar is linked in all the way)
|
||||
plTimerCallbackMsg* timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey());
|
||||
plgTimerCallbackMgr::NewTimer(5, timerMsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
plTimerCallbackMsg* timerMsg = plTimerCallbackMsg::ConvertNoRef(msg);
|
||||
if (timerMsg)
|
||||
{
|
||||
INextProfile();
|
||||
return true;
|
||||
}
|
||||
|
||||
// When the first age starts to load, register the stupid avatar customization variable
|
||||
// so the calibration screen won't pop up and ruin everything. I'm sure I could try
|
||||
// and do this earlier, but I'm not sure when that player folder is set so screw it, it works here.
|
||||
plAgeBeginLoadingMsg* ageBeginLoadingMsg = plAgeBeginLoadingMsg::ConvertNoRef(msg);
|
||||
if (ageBeginLoadingMsg)
|
||||
{
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plAgeBeginLoadingMsg::Index(), GetKey());
|
||||
VaultAddChronicleEntryAndWait(L"InitialAvCursomizationsDone", 0, L"1");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1,46 +1,46 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plAutoProfile_h_inc
|
||||
#define plAutoProfile_h_inc
|
||||
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
class plAutoProfile : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
CLASSNAME_REGISTER(plAutoProfile);
|
||||
GETINTERFACE_ANY(plAutoProfile, hsKeyedObject);
|
||||
|
||||
static plAutoProfile* Instance();
|
||||
|
||||
// If ageName is nil, do all ages
|
||||
virtual void StartProfile(const char* ageName = nil)=0;
|
||||
|
||||
// For when we just want to link to each age, for other reasons (profiling load times)
|
||||
virtual void LinkToAllAges()=0;
|
||||
};
|
||||
|
||||
#endif // plAutoProfile_h_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plAutoProfile_h_inc
|
||||
#define plAutoProfile_h_inc
|
||||
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
class plAutoProfile : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
CLASSNAME_REGISTER(plAutoProfile);
|
||||
GETINTERFACE_ANY(plAutoProfile, hsKeyedObject);
|
||||
|
||||
static plAutoProfile* Instance();
|
||||
|
||||
// If ageName is nil, do all ages
|
||||
virtual void StartProfile(const char* ageName = nil)=0;
|
||||
|
||||
// For when we just want to link to each age, for other reasons (profiling load times)
|
||||
virtual void LinkToAllAges()=0;
|
||||
};
|
||||
|
||||
#endif // plAutoProfile_h_inc
|
||||
|
@ -1,304 +1,304 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plProfile.h"
|
||||
#include "plProfileManager.h"
|
||||
#include "plNetClient/plNetClientMgr.h"
|
||||
#include "hsTimer.h"
|
||||
|
||||
plProfile_CreateCounter("Age Upload BitsPerSec", "Network", UploadAgeBitsPerSec);
|
||||
plProfile_CreateMemCounter("Upload Bytes", "Network", UploadBW);
|
||||
plProfile_CreateMemCounter("Upload Avg Packet Size", "Network", UploadAPS);
|
||||
plProfile_CreateCounter("Upload Num Packets", "Network", UploadPPS);
|
||||
plProfile_CreateCounter("Upload Avg Packets Queued", "Network", UploadPQ);
|
||||
plProfile_CreateCounter("Recvd Multiple Acks", "Network", RMultAcksPQ);
|
||||
|
||||
plProfile_CreateCounter("Age Download BitsPerSec", "Network", DownloadAgeBitsPerSec);
|
||||
plProfile_CreateMemCounter("Download Bytes", "Network", DownloadBW);
|
||||
plProfile_CreateMemCounter("Download Avg Packet Size", "Network", DownloadAPS);
|
||||
plProfile_CreateCounter("Download Num Packets", "Network", DownloadPPS);
|
||||
plProfile_CreateCounter("Download Avg Packets Queued", "Network", DownloadPQ);
|
||||
plProfile_CreateCounter("Download Dropped Pkts", "Network", DownloadDP);
|
||||
|
||||
plProfile_CreateCounter("Remote Players", "Network", RemotePlayers);
|
||||
plProfile_CreateCounter("Peers", "Network", Peers);
|
||||
plProfile_CreateCounter("Player ID", "Network", PlayerID);
|
||||
plProfile_CreateCounter("Account ID", "Network", AccountID);
|
||||
|
||||
plProfile_CreateTimer("Avg Receipt Time", "Network", AvgReceiptTime);
|
||||
plProfile_CreateTimer("Peak Receipt Time", "Network", PeakReceiptTime);
|
||||
|
||||
#ifdef HS_FIND_MEM_LEAKS
|
||||
plProfile_CreateMemCounter("Allocated", "Memory", MemAllocated);
|
||||
plProfile_CreateMemCounter("Peak Alloc", "Memory", MemPeakAlloc);
|
||||
#endif
|
||||
|
||||
static plProfileVar gVarRFPS("RFPS", "General", plProfileVar::kDisplayTime | plProfileVar::kDisplayFPS);
|
||||
|
||||
plProfile_Extern(DrawTriangles);
|
||||
plProfile_Extern(MatChange);
|
||||
plProfile_CreateCounter("Polys Per Material", "General", PolysPerMat);
|
||||
|
||||
#ifdef PL_PROFILE_ENABLED
|
||||
#define plProfile_GetValue(varName) gProfileVar##varName.GetValue()
|
||||
#else
|
||||
#define plProfile_GetValue(varName) 0
|
||||
#endif
|
||||
|
||||
void CalculateProfiles()
|
||||
{
|
||||
// KLUDGE - do timing that overlaps the beginframe / endframe (where timing is normally reset)
|
||||
static UInt32 lastTicks = plProfileManager::GetTime();
|
||||
UInt32 curTicks = plProfileManager::GetTime();
|
||||
gVarRFPS.Set(curTicks - lastTicks);
|
||||
lastTicks = curTicks;
|
||||
|
||||
// KLUDGE - calulate the polys per material
|
||||
if (plProfile_GetValue(MatChange) == 0)
|
||||
plProfile_Set(PolysPerMat, 0);
|
||||
else
|
||||
plProfile_Set(PolysPerMat, plProfile_GetValue(DrawTriangles) / plProfile_GetValue(MatChange));
|
||||
|
||||
#ifdef HS_FIND_MEM_LEAKS
|
||||
// plProfile_Set(MemAllocated, MemGetAllocated());
|
||||
// plProfile_Set(MemPeakAlloc, MemGetPeakAllocated());
|
||||
#endif
|
||||
|
||||
// Network stats
|
||||
plNetClientMgr* nc = plNetClientMgr::GetInstance();
|
||||
if (!nc->GetFlagsBit(plNetClientMgr::kDisabled))
|
||||
{
|
||||
#if 0
|
||||
hsAssert(nc->GetNetCore(), "nil net core in stats?");
|
||||
plNetCoreStats* ns = nc->GetNetCore()->GetStats();
|
||||
|
||||
plProfile_Set(UploadAgeBitsPerSec, (UInt32)nc->GetNetClientStats().GetAgeStatsULBitsPerSec());
|
||||
plProfile_Set(UploadBW, ns->GetULBits()/8);
|
||||
plProfile_Set(UploadPPS, ns->GetULPackets());
|
||||
plProfile_Set(UploadAPS, (UInt32)ns->GetULAvgPacketBytes());
|
||||
plProfile_Set(UploadPQ, (UInt32)ns->GetULAvgNumPacketsQueued());
|
||||
plProfile_Set(RMultAcksPQ, nc->GetNetClientStats().GetRecvdMultipleAcks());
|
||||
|
||||
plProfile_Set(DownloadAgeBitsPerSec, (UInt32)nc->GetNetClientStats().GetAgeStatsDLBitsPerSec());
|
||||
plProfile_Set(DownloadBW, ns->GetDLBits()/8);
|
||||
plProfile_Set(DownloadPPS, ns->GetDLPackets());
|
||||
plProfile_Set(DownloadAPS, (UInt32)ns->GetDLAvgPacketBytes());
|
||||
plProfile_Set(DownloadPQ, (UInt32)ns->GetDLAvgNumPacketsQueued());
|
||||
plProfile_Set(DownloadDP, ns->GetDLDroppedPackets());
|
||||
|
||||
plProfile_Set(RemotePlayers, nc->RemotePlayerKeys().size());
|
||||
plProfile_Set(Peers, ns->GetNumPeers());
|
||||
plProfile_Set(PlayerID, nc->GetPlayerID());
|
||||
plProfile_Set(AccountID, nc->GetAccountID());
|
||||
|
||||
plProfile_Set(AvgReceiptTime, hsTimer::PrecSecsToTicks(ns->GetAvgReceiptTime()));
|
||||
plProfile_Set(PeakReceiptTime, hsTimer::PrecSecsToTicks(ns->GetPeakReceiptTime()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#include "../plPipeline/plPlates.h"
|
||||
|
||||
static plGraphPlate* fFPSPlate = nil;
|
||||
static plGraphPlate* fNetBWPlate = nil;
|
||||
static plGraphPlate* fNetPPSPlate = nil;
|
||||
static plGraphPlate* fNetQueuesPlate = nil;
|
||||
static plGraphPlate* fNetAvgBWPlate = nil;
|
||||
static plGraphPlate* fNetAvgPPSPlate = nil;
|
||||
static plGraphPlate* fNetAvgQueuesPlate = nil;
|
||||
|
||||
static int ICreateStdPlate(plGraphPlate** graph)
|
||||
{
|
||||
if (plPlateManager::InstanceValid())
|
||||
{
|
||||
plPlateManager::Instance().CreateGraphPlate(graph);
|
||||
(*graph)->SetSize(0.25, 0.25);
|
||||
(*graph)->SetDataRange(0, 100, 100);
|
||||
return hsOK;
|
||||
}
|
||||
return hsFail;
|
||||
}
|
||||
|
||||
void CreateStandardGraphs(const char* groupName, bool create)
|
||||
{
|
||||
if (strcmp(groupName, "General") == 0)
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
if (ICreateStdPlate(&fFPSPlate) == hsOK)
|
||||
{
|
||||
fFPSPlate->SetTitle("mSecs");
|
||||
fFPSPlate->SetLabelText("Tot", "Draw", "Upd");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
plPlateManager::Instance().DestroyPlate(fFPSPlate);
|
||||
fFPSPlate = nil;
|
||||
}
|
||||
}
|
||||
else if (strcmp(groupName, "Network") == 0)
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
if (ICreateStdPlate(&fNetBWPlate) == hsOK)
|
||||
{
|
||||
fNetBWPlate->SetDataLabels(0, 2000);
|
||||
fNetBWPlate->SetTitle("Bytes");
|
||||
fNetBWPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetPPSPlate);
|
||||
fNetPPSPlate->SetDataLabels(0, 20);
|
||||
fNetPPSPlate->SetTitle("Packets");
|
||||
fNetPPSPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetQueuesPlate);
|
||||
fNetQueuesPlate->SetDataLabels(0, 20);
|
||||
fNetQueuesPlate->SetTitle("Queue Counts");
|
||||
fNetQueuesPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetQueuesPlate);
|
||||
fNetQueuesPlate->SetDataLabels(0, 20);
|
||||
fNetQueuesPlate->SetTitle("Queue Counts");
|
||||
fNetQueuesPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetQueuesPlate);
|
||||
fNetQueuesPlate->SetDataLabels(0, 20);
|
||||
fNetQueuesPlate->SetTitle("Queue Counts");
|
||||
fNetQueuesPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetAvgBWPlate);
|
||||
fNetAvgBWPlate->SetDataLabels(0, 5000);
|
||||
fNetAvgBWPlate->SetTitle("Avg BytesPS");
|
||||
fNetAvgBWPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetAvgPPSPlate);
|
||||
fNetAvgPPSPlate->SetDataLabels(0, 40);
|
||||
fNetAvgPPSPlate->SetTitle("Avg PacketsPS");
|
||||
fNetAvgPPSPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetAvgQueuesPlate);
|
||||
fNetAvgQueuesPlate->SetDataLabels(0, 40);
|
||||
fNetAvgQueuesPlate->SetTitle("Avg Queue CountsPS");
|
||||
fNetAvgQueuesPlate->SetLabelText("UL", "DL");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
plPlateManager::Instance().DestroyPlate(fNetBWPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetPPSPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetQueuesPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetAvgBWPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetAvgPPSPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetAvgQueuesPlate);
|
||||
fNetBWPlate = nil;
|
||||
fNetPPSPlate = nil;
|
||||
fNetQueuesPlate = nil;
|
||||
fNetAvgBWPlate = nil;
|
||||
fNetAvgPPSPlate = nil;
|
||||
fNetAvgQueuesPlate = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plProfile_CreateTimer("Draw", "General", DrawTime);
|
||||
plProfile_CreateTimer("Update", "General", UpdateTime);
|
||||
|
||||
void UpdateStandardGraphs(float xPos, float yPos)
|
||||
{
|
||||
#define PositionPlate(plate) \
|
||||
plate->SetPosition(xPos, yPos); \
|
||||
yPos += 0.25; \
|
||||
plate->SetVisible(true);
|
||||
|
||||
if (fFPSPlate)
|
||||
{
|
||||
fFPSPlate->AddData(
|
||||
gVarRFPS.GetValue(),
|
||||
plProfile_GetValue(DrawTime),
|
||||
plProfile_GetValue(UpdateTime));
|
||||
PositionPlate(fFPSPlate);
|
||||
}
|
||||
|
||||
plNetClientMgr* nc = plNetClientMgr::GetInstance();
|
||||
|
||||
|
||||
#if 0
|
||||
plNetCoreStats* ns = nc ? nc->GetNetCore()->GetStats() : nil;
|
||||
|
||||
if (!nc || !ns)
|
||||
return;
|
||||
|
||||
if (fNetBWPlate)
|
||||
{
|
||||
fNetBWPlate->AddData(
|
||||
(UInt32)(ns->GetULBits()/8.f),
|
||||
(UInt32)(ns->GetDLBits()/8.f));
|
||||
PositionPlate(fNetBWPlate);
|
||||
}
|
||||
|
||||
if (fNetPPSPlate)
|
||||
{
|
||||
fNetPPSPlate->AddData(
|
||||
ns->GetULPackets(),
|
||||
ns->GetDLPackets());
|
||||
PositionPlate(fNetPPSPlate);
|
||||
}
|
||||
|
||||
if (fNetQueuesPlate)
|
||||
{
|
||||
unsigned int ul, dl;
|
||||
nc->GetNetCore()->GetOutQueueMsgCount(plNetCore::kPeerAll,ul);
|
||||
nc->GetNetCore()->GetInQueueMsgCount(plNetCore::kPeerAll,dl);
|
||||
fNetQueuesPlate->AddData(ul,dl);
|
||||
PositionPlate(fNetQueuesPlate);
|
||||
}
|
||||
|
||||
if (fNetAvgBWPlate)
|
||||
{
|
||||
fNetAvgBWPlate->AddData(
|
||||
(UInt32)(ns->GetULBitsPS()/8.f),
|
||||
(UInt32)(ns->GetDLBitsPS()/8.f));
|
||||
PositionPlate(fNetAvgBWPlate);
|
||||
}
|
||||
|
||||
if (fNetAvgPPSPlate)
|
||||
{
|
||||
fNetAvgPPSPlate->AddData(
|
||||
(Int32)ns->GetULNumPacketsPS(),
|
||||
(Int32)ns->GetDLNumPacketsPS());
|
||||
PositionPlate(fNetAvgPPSPlate);
|
||||
}
|
||||
|
||||
if (fNetAvgQueuesPlate)
|
||||
{
|
||||
fNetAvgQueuesPlate->AddData(
|
||||
(Int32)ns->GetULAvgNumPacketsQueued(),
|
||||
(Int32)ns->GetDLAvgNumPacketsQueued());
|
||||
PositionPlate(fNetAvgQueuesPlate);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plProfile.h"
|
||||
#include "plProfileManager.h"
|
||||
#include "plNetClient/plNetClientMgr.h"
|
||||
#include "hsTimer.h"
|
||||
|
||||
plProfile_CreateCounter("Age Upload BitsPerSec", "Network", UploadAgeBitsPerSec);
|
||||
plProfile_CreateMemCounter("Upload Bytes", "Network", UploadBW);
|
||||
plProfile_CreateMemCounter("Upload Avg Packet Size", "Network", UploadAPS);
|
||||
plProfile_CreateCounter("Upload Num Packets", "Network", UploadPPS);
|
||||
plProfile_CreateCounter("Upload Avg Packets Queued", "Network", UploadPQ);
|
||||
plProfile_CreateCounter("Recvd Multiple Acks", "Network", RMultAcksPQ);
|
||||
|
||||
plProfile_CreateCounter("Age Download BitsPerSec", "Network", DownloadAgeBitsPerSec);
|
||||
plProfile_CreateMemCounter("Download Bytes", "Network", DownloadBW);
|
||||
plProfile_CreateMemCounter("Download Avg Packet Size", "Network", DownloadAPS);
|
||||
plProfile_CreateCounter("Download Num Packets", "Network", DownloadPPS);
|
||||
plProfile_CreateCounter("Download Avg Packets Queued", "Network", DownloadPQ);
|
||||
plProfile_CreateCounter("Download Dropped Pkts", "Network", DownloadDP);
|
||||
|
||||
plProfile_CreateCounter("Remote Players", "Network", RemotePlayers);
|
||||
plProfile_CreateCounter("Peers", "Network", Peers);
|
||||
plProfile_CreateCounter("Player ID", "Network", PlayerID);
|
||||
plProfile_CreateCounter("Account ID", "Network", AccountID);
|
||||
|
||||
plProfile_CreateTimer("Avg Receipt Time", "Network", AvgReceiptTime);
|
||||
plProfile_CreateTimer("Peak Receipt Time", "Network", PeakReceiptTime);
|
||||
|
||||
#ifdef HS_FIND_MEM_LEAKS
|
||||
plProfile_CreateMemCounter("Allocated", "Memory", MemAllocated);
|
||||
plProfile_CreateMemCounter("Peak Alloc", "Memory", MemPeakAlloc);
|
||||
#endif
|
||||
|
||||
static plProfileVar gVarRFPS("RFPS", "General", plProfileVar::kDisplayTime | plProfileVar::kDisplayFPS);
|
||||
|
||||
plProfile_Extern(DrawTriangles);
|
||||
plProfile_Extern(MatChange);
|
||||
plProfile_CreateCounter("Polys Per Material", "General", PolysPerMat);
|
||||
|
||||
#ifdef PL_PROFILE_ENABLED
|
||||
#define plProfile_GetValue(varName) gProfileVar##varName.GetValue()
|
||||
#else
|
||||
#define plProfile_GetValue(varName) 0
|
||||
#endif
|
||||
|
||||
void CalculateProfiles()
|
||||
{
|
||||
// KLUDGE - do timing that overlaps the beginframe / endframe (where timing is normally reset)
|
||||
static UInt32 lastTicks = plProfileManager::GetTime();
|
||||
UInt32 curTicks = plProfileManager::GetTime();
|
||||
gVarRFPS.Set(curTicks - lastTicks);
|
||||
lastTicks = curTicks;
|
||||
|
||||
// KLUDGE - calulate the polys per material
|
||||
if (plProfile_GetValue(MatChange) == 0)
|
||||
plProfile_Set(PolysPerMat, 0);
|
||||
else
|
||||
plProfile_Set(PolysPerMat, plProfile_GetValue(DrawTriangles) / plProfile_GetValue(MatChange));
|
||||
|
||||
#ifdef HS_FIND_MEM_LEAKS
|
||||
// plProfile_Set(MemAllocated, MemGetAllocated());
|
||||
// plProfile_Set(MemPeakAlloc, MemGetPeakAllocated());
|
||||
#endif
|
||||
|
||||
// Network stats
|
||||
plNetClientMgr* nc = plNetClientMgr::GetInstance();
|
||||
if (!nc->GetFlagsBit(plNetClientMgr::kDisabled))
|
||||
{
|
||||
#if 0
|
||||
hsAssert(nc->GetNetCore(), "nil net core in stats?");
|
||||
plNetCoreStats* ns = nc->GetNetCore()->GetStats();
|
||||
|
||||
plProfile_Set(UploadAgeBitsPerSec, (UInt32)nc->GetNetClientStats().GetAgeStatsULBitsPerSec());
|
||||
plProfile_Set(UploadBW, ns->GetULBits()/8);
|
||||
plProfile_Set(UploadPPS, ns->GetULPackets());
|
||||
plProfile_Set(UploadAPS, (UInt32)ns->GetULAvgPacketBytes());
|
||||
plProfile_Set(UploadPQ, (UInt32)ns->GetULAvgNumPacketsQueued());
|
||||
plProfile_Set(RMultAcksPQ, nc->GetNetClientStats().GetRecvdMultipleAcks());
|
||||
|
||||
plProfile_Set(DownloadAgeBitsPerSec, (UInt32)nc->GetNetClientStats().GetAgeStatsDLBitsPerSec());
|
||||
plProfile_Set(DownloadBW, ns->GetDLBits()/8);
|
||||
plProfile_Set(DownloadPPS, ns->GetDLPackets());
|
||||
plProfile_Set(DownloadAPS, (UInt32)ns->GetDLAvgPacketBytes());
|
||||
plProfile_Set(DownloadPQ, (UInt32)ns->GetDLAvgNumPacketsQueued());
|
||||
plProfile_Set(DownloadDP, ns->GetDLDroppedPackets());
|
||||
|
||||
plProfile_Set(RemotePlayers, nc->RemotePlayerKeys().size());
|
||||
plProfile_Set(Peers, ns->GetNumPeers());
|
||||
plProfile_Set(PlayerID, nc->GetPlayerID());
|
||||
plProfile_Set(AccountID, nc->GetAccountID());
|
||||
|
||||
plProfile_Set(AvgReceiptTime, hsTimer::PrecSecsToTicks(ns->GetAvgReceiptTime()));
|
||||
plProfile_Set(PeakReceiptTime, hsTimer::PrecSecsToTicks(ns->GetPeakReceiptTime()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#include "../plPipeline/plPlates.h"
|
||||
|
||||
static plGraphPlate* fFPSPlate = nil;
|
||||
static plGraphPlate* fNetBWPlate = nil;
|
||||
static plGraphPlate* fNetPPSPlate = nil;
|
||||
static plGraphPlate* fNetQueuesPlate = nil;
|
||||
static plGraphPlate* fNetAvgBWPlate = nil;
|
||||
static plGraphPlate* fNetAvgPPSPlate = nil;
|
||||
static plGraphPlate* fNetAvgQueuesPlate = nil;
|
||||
|
||||
static int ICreateStdPlate(plGraphPlate** graph)
|
||||
{
|
||||
if (plPlateManager::InstanceValid())
|
||||
{
|
||||
plPlateManager::Instance().CreateGraphPlate(graph);
|
||||
(*graph)->SetSize(0.25, 0.25);
|
||||
(*graph)->SetDataRange(0, 100, 100);
|
||||
return hsOK;
|
||||
}
|
||||
return hsFail;
|
||||
}
|
||||
|
||||
void CreateStandardGraphs(const char* groupName, bool create)
|
||||
{
|
||||
if (strcmp(groupName, "General") == 0)
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
if (ICreateStdPlate(&fFPSPlate) == hsOK)
|
||||
{
|
||||
fFPSPlate->SetTitle("mSecs");
|
||||
fFPSPlate->SetLabelText("Tot", "Draw", "Upd");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
plPlateManager::Instance().DestroyPlate(fFPSPlate);
|
||||
fFPSPlate = nil;
|
||||
}
|
||||
}
|
||||
else if (strcmp(groupName, "Network") == 0)
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
if (ICreateStdPlate(&fNetBWPlate) == hsOK)
|
||||
{
|
||||
fNetBWPlate->SetDataLabels(0, 2000);
|
||||
fNetBWPlate->SetTitle("Bytes");
|
||||
fNetBWPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetPPSPlate);
|
||||
fNetPPSPlate->SetDataLabels(0, 20);
|
||||
fNetPPSPlate->SetTitle("Packets");
|
||||
fNetPPSPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetQueuesPlate);
|
||||
fNetQueuesPlate->SetDataLabels(0, 20);
|
||||
fNetQueuesPlate->SetTitle("Queue Counts");
|
||||
fNetQueuesPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetQueuesPlate);
|
||||
fNetQueuesPlate->SetDataLabels(0, 20);
|
||||
fNetQueuesPlate->SetTitle("Queue Counts");
|
||||
fNetQueuesPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetQueuesPlate);
|
||||
fNetQueuesPlate->SetDataLabels(0, 20);
|
||||
fNetQueuesPlate->SetTitle("Queue Counts");
|
||||
fNetQueuesPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetAvgBWPlate);
|
||||
fNetAvgBWPlate->SetDataLabels(0, 5000);
|
||||
fNetAvgBWPlate->SetTitle("Avg BytesPS");
|
||||
fNetAvgBWPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetAvgPPSPlate);
|
||||
fNetAvgPPSPlate->SetDataLabels(0, 40);
|
||||
fNetAvgPPSPlate->SetTitle("Avg PacketsPS");
|
||||
fNetAvgPPSPlate->SetLabelText("UL", "DL");
|
||||
|
||||
ICreateStdPlate(&fNetAvgQueuesPlate);
|
||||
fNetAvgQueuesPlate->SetDataLabels(0, 40);
|
||||
fNetAvgQueuesPlate->SetTitle("Avg Queue CountsPS");
|
||||
fNetAvgQueuesPlate->SetLabelText("UL", "DL");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
plPlateManager::Instance().DestroyPlate(fNetBWPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetPPSPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetQueuesPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetAvgBWPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetAvgPPSPlate);
|
||||
plPlateManager::Instance().DestroyPlate(fNetAvgQueuesPlate);
|
||||
fNetBWPlate = nil;
|
||||
fNetPPSPlate = nil;
|
||||
fNetQueuesPlate = nil;
|
||||
fNetAvgBWPlate = nil;
|
||||
fNetAvgPPSPlate = nil;
|
||||
fNetAvgQueuesPlate = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plProfile_CreateTimer("Draw", "General", DrawTime);
|
||||
plProfile_CreateTimer("Update", "General", UpdateTime);
|
||||
|
||||
void UpdateStandardGraphs(float xPos, float yPos)
|
||||
{
|
||||
#define PositionPlate(plate) \
|
||||
plate->SetPosition(xPos, yPos); \
|
||||
yPos += 0.25; \
|
||||
plate->SetVisible(true);
|
||||
|
||||
if (fFPSPlate)
|
||||
{
|
||||
fFPSPlate->AddData(
|
||||
gVarRFPS.GetValue(),
|
||||
plProfile_GetValue(DrawTime),
|
||||
plProfile_GetValue(UpdateTime));
|
||||
PositionPlate(fFPSPlate);
|
||||
}
|
||||
|
||||
plNetClientMgr* nc = plNetClientMgr::GetInstance();
|
||||
|
||||
|
||||
#if 0
|
||||
plNetCoreStats* ns = nc ? nc->GetNetCore()->GetStats() : nil;
|
||||
|
||||
if (!nc || !ns)
|
||||
return;
|
||||
|
||||
if (fNetBWPlate)
|
||||
{
|
||||
fNetBWPlate->AddData(
|
||||
(UInt32)(ns->GetULBits()/8.f),
|
||||
(UInt32)(ns->GetDLBits()/8.f));
|
||||
PositionPlate(fNetBWPlate);
|
||||
}
|
||||
|
||||
if (fNetPPSPlate)
|
||||
{
|
||||
fNetPPSPlate->AddData(
|
||||
ns->GetULPackets(),
|
||||
ns->GetDLPackets());
|
||||
PositionPlate(fNetPPSPlate);
|
||||
}
|
||||
|
||||
if (fNetQueuesPlate)
|
||||
{
|
||||
unsigned int ul, dl;
|
||||
nc->GetNetCore()->GetOutQueueMsgCount(plNetCore::kPeerAll,ul);
|
||||
nc->GetNetCore()->GetInQueueMsgCount(plNetCore::kPeerAll,dl);
|
||||
fNetQueuesPlate->AddData(ul,dl);
|
||||
PositionPlate(fNetQueuesPlate);
|
||||
}
|
||||
|
||||
if (fNetAvgBWPlate)
|
||||
{
|
||||
fNetAvgBWPlate->AddData(
|
||||
(UInt32)(ns->GetULBitsPS()/8.f),
|
||||
(UInt32)(ns->GetDLBitsPS()/8.f));
|
||||
PositionPlate(fNetAvgBWPlate);
|
||||
}
|
||||
|
||||
if (fNetAvgPPSPlate)
|
||||
{
|
||||
fNetAvgPPSPlate->AddData(
|
||||
(Int32)ns->GetULNumPacketsPS(),
|
||||
(Int32)ns->GetDLNumPacketsPS());
|
||||
PositionPlate(fNetAvgPPSPlate);
|
||||
}
|
||||
|
||||
if (fNetAvgQueuesPlate)
|
||||
{
|
||||
fNetAvgQueuesPlate->AddData(
|
||||
(Int32)ns->GetULAvgNumPacketsQueued(),
|
||||
(Int32)ns->GetDLAvgNumPacketsQueued());
|
||||
PositionPlate(fNetAvgQueuesPlate);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -1,29 +1,29 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
void CalculateProfiles();
|
||||
void CreateStandardGraphs(const char* groupName, bool create);
|
||||
void UpdateStandardGraphs(float xPos, float yPos);
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
void CalculateProfiles();
|
||||
void CreateStandardGraphs(const char* groupName, bool create);
|
||||
void UpdateStandardGraphs(float xPos, float yPos);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,115 +1,115 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plProfileManagerFull_h_inc
|
||||
#define plProfileManagerFull_h_inc
|
||||
|
||||
#include "plProfileManager.h"
|
||||
|
||||
#include "hsStlUtils.h"
|
||||
|
||||
#include "hsStlSortUtils.h"
|
||||
|
||||
class plProfileManager;
|
||||
class plGraphPlate;
|
||||
class plStatusLog;
|
||||
class hsStream;
|
||||
class plProfileVar;
|
||||
|
||||
class plProfileManagerFull
|
||||
{
|
||||
public:
|
||||
typedef std::set<const char*, stringISorter> GroupSet;
|
||||
|
||||
protected:
|
||||
plProfileManager::VarVec& fVars;
|
||||
|
||||
bool fLogStats; // If true, log the stats at the end of the frame
|
||||
std::wstring fLogAgeName;
|
||||
std::string fLogSpawnName;
|
||||
|
||||
std::vector<plGraphPlate*> fGraphs;
|
||||
plGraphPlate* fDetailGraph;
|
||||
|
||||
struct detailVar
|
||||
{
|
||||
plProfileVar* var;
|
||||
Int32 min;
|
||||
Int32 max;
|
||||
};
|
||||
|
||||
std::vector<detailVar> fDetailVars; // the vars we want to show on the detail graph
|
||||
|
||||
GroupSet fShowGroups;
|
||||
plProfileVar* fShowLaps;
|
||||
UInt32 fMinLap; // For Display
|
||||
|
||||
void IPrintGroup(hsStream* s, const char* groupName, bool printTitle=false);
|
||||
void ILogStats();
|
||||
|
||||
plProfileVar* IFindTimer(const char* name);
|
||||
|
||||
void ISetActive(const char* groupName, bool active);
|
||||
|
||||
plProfileManagerFull();
|
||||
|
||||
public:
|
||||
static plProfileManagerFull& Instance();
|
||||
|
||||
void EndFrame(); // Call end frame on our special timers
|
||||
void Update();
|
||||
|
||||
void GetGroups(GroupSet& groups);
|
||||
void ShowGroup(const char* groupName);
|
||||
void ShowNextGroup();
|
||||
|
||||
struct LapPair { const char* group; const char* varName; };
|
||||
typedef std::vector<LapPair> LapNames;
|
||||
void GetLaps(LapNames& lapNames);
|
||||
void ShowLaps(const char* groupName, const char* varName);
|
||||
void SetMinLap(int m) { fMinLap = m; };
|
||||
void PageDownLaps() { fMinLap += 40; }
|
||||
void PageUpLaps() { fMinLap = (fMinLap < 40) ? 0 : fMinLap - 40;}
|
||||
|
||||
void CreateGraph(const char* varName, UInt32 min, UInt32 max);
|
||||
|
||||
void ResetDefaultDetailVars();
|
||||
void ShowDetailGraph();
|
||||
void HideDetailGraph();
|
||||
void AddDetailVar(const char* varName, UInt32 min, UInt32 max);
|
||||
void RemoveDetailVar(const char* varName);
|
||||
void UpdateDetailLabels();
|
||||
|
||||
void ResetMax();
|
||||
|
||||
void LogStats(const char* ageName, const char* spawnName);
|
||||
const wchar* GetProfilePath();
|
||||
|
||||
// If you're going to call LogStats, make sure to call this first so all stats will be evaluated before logging
|
||||
void ActivateAllStats();
|
||||
|
||||
};
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plProfileManagerFull_h_inc
|
||||
#define plProfileManagerFull_h_inc
|
||||
|
||||
#include "plProfileManager.h"
|
||||
|
||||
#include "hsStlUtils.h"
|
||||
|
||||
#include "hsStlSortUtils.h"
|
||||
|
||||
class plProfileManager;
|
||||
class plGraphPlate;
|
||||
class plStatusLog;
|
||||
class hsStream;
|
||||
class plProfileVar;
|
||||
|
||||
class plProfileManagerFull
|
||||
{
|
||||
public:
|
||||
typedef std::set<const char*, stringISorter> GroupSet;
|
||||
|
||||
protected:
|
||||
plProfileManager::VarVec& fVars;
|
||||
|
||||
bool fLogStats; // If true, log the stats at the end of the frame
|
||||
std::wstring fLogAgeName;
|
||||
std::string fLogSpawnName;
|
||||
|
||||
std::vector<plGraphPlate*> fGraphs;
|
||||
plGraphPlate* fDetailGraph;
|
||||
|
||||
struct detailVar
|
||||
{
|
||||
plProfileVar* var;
|
||||
Int32 min;
|
||||
Int32 max;
|
||||
};
|
||||
|
||||
std::vector<detailVar> fDetailVars; // the vars we want to show on the detail graph
|
||||
|
||||
GroupSet fShowGroups;
|
||||
plProfileVar* fShowLaps;
|
||||
UInt32 fMinLap; // For Display
|
||||
|
||||
void IPrintGroup(hsStream* s, const char* groupName, bool printTitle=false);
|
||||
void ILogStats();
|
||||
|
||||
plProfileVar* IFindTimer(const char* name);
|
||||
|
||||
void ISetActive(const char* groupName, bool active);
|
||||
|
||||
plProfileManagerFull();
|
||||
|
||||
public:
|
||||
static plProfileManagerFull& Instance();
|
||||
|
||||
void EndFrame(); // Call end frame on our special timers
|
||||
void Update();
|
||||
|
||||
void GetGroups(GroupSet& groups);
|
||||
void ShowGroup(const char* groupName);
|
||||
void ShowNextGroup();
|
||||
|
||||
struct LapPair { const char* group; const char* varName; };
|
||||
typedef std::vector<LapPair> LapNames;
|
||||
void GetLaps(LapNames& lapNames);
|
||||
void ShowLaps(const char* groupName, const char* varName);
|
||||
void SetMinLap(int m) { fMinLap = m; };
|
||||
void PageDownLaps() { fMinLap += 40; }
|
||||
void PageUpLaps() { fMinLap = (fMinLap < 40) ? 0 : fMinLap - 40;}
|
||||
|
||||
void CreateGraph(const char* varName, UInt32 min, UInt32 max);
|
||||
|
||||
void ResetDefaultDetailVars();
|
||||
void ShowDetailGraph();
|
||||
void HideDetailGraph();
|
||||
void AddDetailVar(const char* varName, UInt32 min, UInt32 max);
|
||||
void RemoveDetailVar(const char* varName);
|
||||
void UpdateDetailLabels();
|
||||
|
||||
void ResetMax();
|
||||
|
||||
void LogStats(const char* ageName, const char* spawnName);
|
||||
const wchar* GetProfilePath();
|
||||
|
||||
// If you're going to call LogStats, make sure to call this first so all stats will be evaluated before logging
|
||||
void ActivateAllStats();
|
||||
|
||||
};
|
||||
|
||||
#endif // plProfileManagerFull_h_inc
|
@ -1,34 +1,34 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plStatGatherCreatable_h_inc
|
||||
#define plStatGatherCreatable_h_inc
|
||||
|
||||
#include "pnFactory/plCreator.h"
|
||||
|
||||
#include "plAutoProfile.h"
|
||||
REGISTER_NONCREATABLE(plAutoProfile);
|
||||
|
||||
#endif // plStatGatherCreatable_h_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plStatGatherCreatable_h_inc
|
||||
#define plStatGatherCreatable_h_inc
|
||||
|
||||
#include "pnFactory/plCreator.h"
|
||||
|
||||
#include "plAutoProfile.h"
|
||||
REGISTER_NONCREATABLE(plAutoProfile);
|
||||
|
||||
#endif // plStatGatherCreatable_h_inc
|
||||
|
Reference in New Issue
Block a user