X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/412a5c570d18aa64f0077a3278ca232776f3f259..0576cd9ebe3430bdf7acf69e1dd1df92273f32ad:/tests/benchmarks/printfbench.cpp diff --git a/tests/benchmarks/printfbench.cpp b/tests/benchmarks/printfbench.cpp index 49f5d8e433..f4c2ffb9b5 100644 --- a/tests/benchmarks/printfbench.cpp +++ b/tests/benchmarks/printfbench.cpp @@ -9,6 +9,32 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// +// Profiling under Linux: +// ===================== +// +// 1) configure wxWidgets in release mode +// 2) make sure that HAVE_UNIX98_PRINTF is undefined (just #defining it to zero +// does not work; you must comment out the entire #define) in your setup.h; +// and also that wxUSE_PRINTF_POS_PARAMS is set to 1; this will force the +// use of wx's own implementation of wxVsnprintf() +// 3) compile wx +// 4) set wxTEST_WX_ONLY to 1 and compile tests as well +// +// Now you have two main choices: +// +// - using gprof: +// 5) add to the Makefile of this test program the -pg option both to +// CXXFLAGS and to LDFLAGS +// 6) run the test +// 7) look at the gmon.out file with gprof utility +// +// - using valgrind: +// 4) run "valgrind --tool=callgrind ./printfbench" +// 5) run "kcachegrind dump_file_generated_by_callgrind" +// + + // ============================================================================ // declarations // ============================================================================ @@ -17,27 +43,37 @@ // headers // ---------------------------------------------------------------------------- -#include +#include "testprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include +#endif // WX_PRECOMP + #include #include #include #include +#include // ---------------------------------------------------------------------------- // command line // ---------------------------------------------------------------------------- -#define HELP_SWITCH wxT("h") -#define NUMBENCHMARK_OPTION wxT("n") +#define HELP_SWITCH "h" +#define NUMBENCHMARK_OPTION "n" static const wxCmdLineEntryDesc g_cmdLineDesc[] = { - { wxCMD_LINE_SWITCH, HELP_SWITCH, wxT("help"), - wxT("displays help on the command line parameters") }, + { wxCMD_LINE_SWITCH, HELP_SWITCH, "help", + "displays help on the command line parameters" }, - { wxCMD_LINE_OPTION, NUMBENCHMARK_OPTION, wxT("numtest"), - wxT("the number of wxPrintf() calls to benchmark"), wxCMD_LINE_VAL_NUMBER }, + { wxCMD_LINE_OPTION, NUMBENCHMARK_OPTION, "numtest", + "the number of wxPrintf() calls to benchmark", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_NONE } }; @@ -51,18 +87,6 @@ static const wxCmdLineEntryDesc g_cmdLineDesc[] = #define BUFSIZE 10000 // set wxTEST_WX_ONLY to 1 when you want to profile wx's implementation only. -// A little reminder about profiling under Linux: -// -// 1) configure wxWidgets in release mode -// 2) make sure that HAVE_UNIX98_PRINTF is undefined (just #defining it to zero -// does not work; you must comment out the entire #define) in your setup.h; -// and also that wxUSE_PRINTF_POS_PARAMS is set to 1; this will force the -// use of wx's own implementation of wxVsnprintf() -// 3) compile wx -// 4) set wxTEST_WX_ONLY to 1 and compile tests as well -// 5) run "callgrind ./printfbench" -// 6) run "kcachegrind dump_file_generated_by_callgrind" -// #define wxTEST_WX_ONLY 1