mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 15:39:10 +00:00
Remove newlines from log messages
This commit is contained in:
parent
17625e20df
commit
718034f5fa
123 changed files with 1143 additions and 1118 deletions
|
@ -68,7 +68,7 @@ callback(void *param, SDL_TimerID timerID, Uint32 interval)
|
|||
{
|
||||
int value = (int)(uintptr_t)param;
|
||||
SDL_assert( value == 1 || value == 2 || value == 3 );
|
||||
SDL_Log("Timer %" SDL_PRIu32 " : param = %d\n", interval, value);
|
||||
SDL_Log("Timer %" SDL_PRIu32 " : param = %d", interval, value);
|
||||
return interval;
|
||||
}
|
||||
|
||||
|
@ -123,13 +123,13 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Verify SDL_GetTicks* acts monotonically increasing, and not erratic. */
|
||||
SDL_Log("Sanity-checking GetTicks\n");
|
||||
SDL_Log("Sanity-checking GetTicks");
|
||||
for (i = 0; i < 1000; ++i) {
|
||||
start = SDL_GetTicks();
|
||||
SDL_Delay(1);
|
||||
now = SDL_GetTicks() - start;
|
||||
if (now > 100) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testtimer.c: Delta time erratic at iter %d. Delay 1ms = %d ms in ticks\n", i, (int)now);
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testtimer.c: Delta time erratic at iter %d. Delay 1ms = %d ms in ticks", i, (int)now);
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
|
|||
t1 = SDL_AddTimer(desired, ticktock, NULL);
|
||||
|
||||
/* Wait 1 seconds */
|
||||
SDL_Log("Waiting 1 seconds for millisecond timer\n");
|
||||
SDL_Log("Waiting 1 seconds for millisecond timer");
|
||||
SDL_Delay(1 * 1000);
|
||||
|
||||
/* Stop the timer */
|
||||
|
@ -151,7 +151,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Print the results */
|
||||
if (ticks) {
|
||||
SDL_Log("Millisecond timer resolution: desired = %d ms, actual = %f ms\n",
|
||||
SDL_Log("Millisecond timer resolution: desired = %d ms, actual = %f ms",
|
||||
desired, (double)(10 * 1000) / ticks);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
|||
t1 = SDL_AddTimerNS(desired, ticktockNS, NULL);
|
||||
|
||||
/* Wait 1 seconds */
|
||||
SDL_Log("Waiting 1 seconds for nanosecond timer\n");
|
||||
SDL_Log("Waiting 1 seconds for nanosecond timer");
|
||||
SDL_Delay(1 * 1000);
|
||||
|
||||
/* Stop the timer */
|
||||
|
@ -171,7 +171,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Print the results */
|
||||
if (ticks) {
|
||||
SDL_Log("Nanosecond timer resolution: desired = %d ns, actual = %f ns\n",
|
||||
SDL_Log("Nanosecond timer resolution: desired = %d ns, actual = %f ns",
|
||||
desired, (double)(10 * 1000000) / ticks);
|
||||
}
|
||||
|
||||
|
@ -188,9 +188,9 @@ int main(int argc, char *argv[])
|
|||
SDL_DelayNS(1);
|
||||
now = SDL_GetTicksNS();
|
||||
actual_delay = (now - start);
|
||||
SDL_Log("Minimum nanosecond delay: %" SDL_PRIu64 " ns\n", actual_delay);
|
||||
SDL_Log("Minimum nanosecond delay: %" SDL_PRIu64 " ns", actual_delay);
|
||||
|
||||
SDL_Log("Timing 100 frames at 60 FPS\n");
|
||||
SDL_Log("Timing 100 frames at 60 FPS");
|
||||
for (i = 0; i < 100; ++i) {
|
||||
start = SDL_GetTicksNS();
|
||||
SDL_DelayNS(desired_delay);
|
||||
|
@ -200,7 +200,7 @@ int main(int argc, char *argv[])
|
|||
total_overslept += (actual_delay - desired_delay);
|
||||
}
|
||||
}
|
||||
SDL_Log("Overslept %.2f ms\n", (double)total_overslept / SDL_NS_PER_MS);
|
||||
SDL_Log("Overslept %.2f ms", (double)total_overslept / SDL_NS_PER_MS);
|
||||
}
|
||||
|
||||
/* Wait for the results to be seen */
|
||||
|
@ -216,9 +216,9 @@ int main(int argc, char *argv[])
|
|||
SDL_DelayPrecise(1);
|
||||
now = SDL_GetTicksNS();
|
||||
actual_delay = (now - start);
|
||||
SDL_Log("Minimum precise delay: %" SDL_PRIu64 " ns\n", actual_delay);
|
||||
SDL_Log("Minimum precise delay: %" SDL_PRIu64 " ns", actual_delay);
|
||||
|
||||
SDL_Log("Timing 100 frames at 60 FPS\n");
|
||||
SDL_Log("Timing 100 frames at 60 FPS");
|
||||
for (i = 0; i < 100; ++i) {
|
||||
start = SDL_GetTicksNS();
|
||||
SDL_DelayPrecise(desired_delay);
|
||||
|
@ -228,32 +228,32 @@ int main(int argc, char *argv[])
|
|||
total_overslept += (actual_delay - desired_delay);
|
||||
}
|
||||
}
|
||||
SDL_Log("Overslept %.2f ms\n", (double)total_overslept / SDL_NS_PER_MS);
|
||||
SDL_Log("Overslept %.2f ms", (double)total_overslept / SDL_NS_PER_MS);
|
||||
}
|
||||
|
||||
/* Wait for the results to be seen */
|
||||
SDL_Delay(1 * 1000);
|
||||
|
||||
/* Test multiple timers */
|
||||
SDL_Log("Testing multiple timers...\n");
|
||||
SDL_Log("Testing multiple timers...");
|
||||
t1 = SDL_AddTimer(100, callback, (void *)1);
|
||||
if (!t1) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 1: %s\n", SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 1: %s", SDL_GetError());
|
||||
}
|
||||
t2 = SDL_AddTimer(50, callback, (void *)2);
|
||||
if (!t2) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 2: %s\n", SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 2: %s", SDL_GetError());
|
||||
}
|
||||
t3 = SDL_AddTimer(233, callback, (void *)3);
|
||||
if (!t3) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 3: %s\n", SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 3: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
/* Wait 3 seconds */
|
||||
SDL_Log("Waiting 3 seconds\n");
|
||||
SDL_Log("Waiting 3 seconds");
|
||||
SDL_Delay(3 * 1000);
|
||||
|
||||
SDL_Log("Removing timer 1 and waiting 3 more seconds\n");
|
||||
SDL_Log("Removing timer 1 and waiting 3 more seconds");
|
||||
SDL_RemoveTimer(t1);
|
||||
|
||||
SDL_Delay(3 * 1000);
|
||||
|
@ -267,15 +267,15 @@ int main(int argc, char *argv[])
|
|||
ticktock(NULL, 0, 0);
|
||||
}
|
||||
now_perf = SDL_GetPerformanceCounter();
|
||||
SDL_Log("1 million iterations of ticktock took %f ms\n", (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency());
|
||||
SDL_Log("1 million iterations of ticktock took %f ms", (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency());
|
||||
|
||||
SDL_Log("Performance counter frequency: %" SDL_PRIu64 "\n", SDL_GetPerformanceFrequency());
|
||||
SDL_Log("Performance counter frequency: %" SDL_PRIu64, SDL_GetPerformanceFrequency());
|
||||
start = SDL_GetTicks();
|
||||
start_perf = SDL_GetPerformanceCounter();
|
||||
SDL_Delay(1000);
|
||||
now_perf = SDL_GetPerformanceCounter();
|
||||
now = SDL_GetTicks();
|
||||
SDL_Log("Delay 1 second = %d ms in ticks, %f ms according to performance counter\n", (int)(now - start), (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency());
|
||||
SDL_Log("Delay 1 second = %d ms in ticks, %f ms according to performance counter", (int)(now - start), (double)((now_perf - start_perf) * 1000) / SDL_GetPerformanceFrequency());
|
||||
|
||||
if (run_interactive_tests) {
|
||||
return_code = test_sdl_delay_within_bounds();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue