mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Use stopwatch instead of utc time for debug loading time messages
This commit is contained in:
parent
0ca8c34c29
commit
b65d8ab050
@ -1419,7 +1419,7 @@ static void UpdatesScreen_Get(cc_bool release, cc_bool d3d9) {
|
|||||||
String str; char strBuffer[STRING_SIZE];
|
String str; char strBuffer[STRING_SIZE];
|
||||||
struct UpdatesScreen* s = &UpdatesScreen_Instance;
|
struct UpdatesScreen* s = &UpdatesScreen_Instance;
|
||||||
|
|
||||||
TimeMS time = release ? CheckUpdateTask.relTimestamp : CheckUpdateTask.devTimestamp;
|
cc_uint64 time = release ? CheckUpdateTask.relTimestamp : CheckUpdateTask.devTimestamp;
|
||||||
if (!time || FetchUpdateTask.Base.working) return;
|
if (!time || FetchUpdateTask.Base.working) return;
|
||||||
FetchUpdateTask_Run(release, d3d9);
|
FetchUpdateTask_Run(release, d3d9);
|
||||||
|
|
||||||
@ -1489,7 +1489,7 @@ static void UpdatesScreen_DevD3D9(void* w, int x, int y) { UpdatesScreen_Get(f
|
|||||||
static void UpdatesScreen_DevOpenGL(void* w, int x, int y) { UpdatesScreen_Get(false, false); }
|
static void UpdatesScreen_DevOpenGL(void* w, int x, int y) { UpdatesScreen_Get(false, false); }
|
||||||
|
|
||||||
static void UpdatesScreen_Update(struct UpdatesScreen* s) {
|
static void UpdatesScreen_Update(struct UpdatesScreen* s) {
|
||||||
TimeMS buildTime;
|
cc_uint64 buildTime;
|
||||||
cc_result res;
|
cc_result res;
|
||||||
|
|
||||||
/* Initially fill out with update check result from main menu */
|
/* Initially fill out with update check result from main menu */
|
||||||
|
@ -201,18 +201,20 @@ static void LWebTask_Reset(struct LWebTask* task) {
|
|||||||
task->completed = false;
|
task->completed = false;
|
||||||
task->working = true;
|
task->working = true;
|
||||||
task->success = false;
|
task->success = false;
|
||||||
task->start = DateTime_CurrentUTC_MS();
|
task->start = Stopwatch_Measure();
|
||||||
task->res = 0;
|
task->res = 0;
|
||||||
task->status = 0;
|
task->status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LWebTask_Tick(struct LWebTask* task) {
|
void LWebTask_Tick(struct LWebTask* task) {
|
||||||
struct HttpRequest req;
|
struct HttpRequest req;
|
||||||
|
cc_uint64 finish;
|
||||||
int delta;
|
int delta;
|
||||||
if (task->completed) return;
|
if (task->completed) return;
|
||||||
|
|
||||||
if (!Http_GetResult(&task->identifier, &req)) return;
|
if (!Http_GetResult(&task->identifier, &req)) return;
|
||||||
delta = (int)(DateTime_CurrentUTC_MS() - task->start);
|
finish = Stopwatch_Measure();
|
||||||
|
delta = (int)Stopwatch_ElapsedMilliseconds(task->start, finish);
|
||||||
Platform_Log2("%s took %i", &task->identifier, &delta);
|
Platform_Log2("%s took %i", &task->identifier, &delta);
|
||||||
|
|
||||||
task->res = req.result;
|
task->res = req.result;
|
||||||
|
@ -49,7 +49,7 @@ struct LWebTask {
|
|||||||
|
|
||||||
String identifier; /* Unique identifier for this web task. */
|
String identifier; /* Unique identifier for this web task. */
|
||||||
String url; /* URL this task is downloading from/uploading to. */
|
String url; /* URL this task is downloading from/uploading to. */
|
||||||
TimeMS start; /* Point in time this task was started at. */
|
cc_uint64 start; /* Timestamp of when this task was started at. */
|
||||||
/* Called when task successfully downloaded/uploaded data. */
|
/* Called when task successfully downloaded/uploaded data. */
|
||||||
void (*Handle)(cc_uint8* data, cc_uint32 len);
|
void (*Handle)(cc_uint8* data, cc_uint32 len);
|
||||||
};
|
};
|
||||||
|
@ -110,7 +110,7 @@ static void Launcher_OnResize(void* obj) {
|
|||||||
static cc_bool Launcher_IsShutdown(int key) {
|
static cc_bool Launcher_IsShutdown(int key) {
|
||||||
if (key == KEY_F4 && Key_IsAltPressed()) return true;
|
if (key == KEY_F4 && Key_IsAltPressed()) return true;
|
||||||
|
|
||||||
/* On OSX, Cmd+Q should also terminate the process */
|
/* On macOS, Cmd+Q should also terminate the process */
|
||||||
#ifdef CC_BUILD_OSX
|
#ifdef CC_BUILD_OSX
|
||||||
return key == 'Q' && Key_IsWinPressed();
|
return key == 'Q' && Key_IsWinPressed();
|
||||||
#else
|
#else
|
||||||
|
@ -36,7 +36,7 @@ static cc_bool classic_receivedFirstPos;
|
|||||||
|
|
||||||
/* Map state */
|
/* Map state */
|
||||||
static cc_bool map_begunLoading;
|
static cc_bool map_begunLoading;
|
||||||
static TimeMS map_receiveStart;
|
static cc_uint64 map_receiveBeg;
|
||||||
static struct Stream map_part;
|
static struct Stream map_part;
|
||||||
static struct GZipHeader map_gzHeader;
|
static struct GZipHeader map_gzHeader;
|
||||||
static int map_sizeIndex, map_volume;
|
static int map_sizeIndex, map_volume;
|
||||||
@ -446,7 +446,7 @@ static void Classic_StartLoading(void) {
|
|||||||
GZipHeader_Init(&map_gzHeader);
|
GZipHeader_Init(&map_gzHeader);
|
||||||
map_begunLoading = true;
|
map_begunLoading = true;
|
||||||
map_sizeIndex = 0;
|
map_sizeIndex = 0;
|
||||||
map_receiveStart = DateTime_CurrentUTC_MS();
|
map_receiveBeg = Stopwatch_Measure();
|
||||||
map_volume = 0;
|
map_volume = 0;
|
||||||
|
|
||||||
MapState_Init(&map);
|
MapState_Init(&map);
|
||||||
@ -526,13 +526,15 @@ static void Classic_LevelDataChunk(cc_uint8* data) {
|
|||||||
|
|
||||||
static void Classic_LevelFinalise(cc_uint8* data) {
|
static void Classic_LevelFinalise(cc_uint8* data) {
|
||||||
int width, height, length;
|
int width, height, length;
|
||||||
int loadingMs;
|
cc_uint64 end;
|
||||||
|
int delta;
|
||||||
|
|
||||||
Gui_Remove(LoadingScreen_UNSAFE_RawPointer);
|
Gui_Remove(LoadingScreen_UNSAFE_RawPointer);
|
||||||
Camera_CheckFocus();
|
Camera_CheckFocus();
|
||||||
|
|
||||||
loadingMs = (int)(DateTime_CurrentUTC_MS() - map_receiveStart);
|
end = Stopwatch_Measure();
|
||||||
Platform_Log1("map loading took: %i", &loadingMs);
|
delta = Stopwatch_ElapsedMilliseconds(map_receiveBeg, end);
|
||||||
|
Platform_Log1("map loading took: %i", &delta);
|
||||||
map_begunLoading = false;
|
map_begunLoading = false;
|
||||||
WoM_CheckSendWomID();
|
WoM_CheckSendWomID();
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
/* Represents a particular instance in time in some timezone. Not necessarily UTC time. */
|
/* Represents a particular instance in time in some timezone. Not necessarily UTC time. */
|
||||||
/* NOTE: TimeMS and DateTime_CurrentUTC_MS() should almost always be used instead. */
|
/* NOTE: TimeMS and DateTime_CurrentUTC_MS() should almost always be used instead. */
|
||||||
/* This should only be used when actually needed. (e.g. log mesage time) */
|
/* This struct should only be used when actually needed. (e.g. log message time) */
|
||||||
struct DateTime {
|
struct DateTime {
|
||||||
int year; /* Year, ranges from 0 to 65535 */
|
int year; /* Year, ranges from 0 to 65535 */
|
||||||
int month; /* Month, ranges from 1 to 12 */
|
int month; /* Month, ranges from 1 to 12 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user