Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Profiler v1.3 (copyright (c) 2014-2017 Daniel_Cortez) \\ Pro-Pawn.ru
- // Условия использования данного кода: http://pro-pawn.ru/showthread.php?12585
- #tryinclude <a_samp>
- /*======== Настройки =========================================================*/
- // Кол-во итераций в циклах.
- const PROFILER_ITERATIONS_MAJOR = 10_000;
- const PROFILER_ITERATIONS_MINOR = 1_000;
- new const code_snippets_names[4][] =
- {
- {"Snegovik1337"},
- {"DeimoS"},
- {"Long-"},
- {"ziggi"}
- };
- enum e_pInfo
- {
- pSex,
- pSkin
- };
- new pInfo[MAX_PLAYERS][e_pInfo];
- new Random_Skin_Male[] =
- {
- 292, 293
- };
- new Random_Skin_Female[] =
- {
- 12, 138
- };
- new Random_Skin[2][] =
- {
- {292, 293},
- {12, 138}
- };
- #define Prerequisites();\
- new listitem = 1;
- #define CodeSnippet0();\
- pInfo[999][pSex] = listitem+1;\
- pInfo[999][pSkin] = (listitem == 0)?\
- (Random_Skin_Male[random(sizeof(Random_Skin_Male))]):(Random_Skin_Female[random(sizeof(Random_Skin_Female))]);
- #define CodeSnippet1(); \
- switch(listitem) {\
- case 0: {\
- pInfo[999][pSex] = 1;\
- pInfo[999][pSkin] = Random_Skin_Male[random(sizeof(Random_Skin_Male))];\
- }\
- case 1: {\
- pInfo[999][pSex] = 2;\
- pInfo[999][pSkin] = Random_Skin_Female[random(sizeof(Random_Skin_Female))];\
- }\
- }
- #define CodeSnippet2();\
- pInfo[999][pSex] = listitem + 1;\
- if(pInfo[999][pSex] == 1)\
- pInfo[999][pSkin] = Random_Skin_Male[random(sizeof(Random_Skin_Male))];\
- else\
- pInfo[999][pSkin] = Random_Skin_Female[random(sizeof(Random_Skin_Female))];
- #define CodeSnippet3();\
- pInfo[999][pSex] = listitem + 1;\
- pInfo[999][pSkin] = Random_Skin[listitem][random(sizeof(Random_Skin[]))];
- /*======== Конец настроек ===================================================*/
- // Не рекомендую изменять следующий код, если вы в нём не разбираетесь.
- #if defined _samp_included
- #define LINE_BREAK ""
- #else
- #define LINE_BREAK "\n"
- #include <core>
- #include <time>
- #define GetTickCount() tickcount()
- #endif
- #define _PROFILE_START(%0)\
- __t[%0] = GetTickCount();\
- for (__j = 0; __j < PROFILER_ITERATIONS_MINOR; ++__j)\
- {
- #define _PROFILE_END(%0) __t[%0] = GetTickCount()-__t[%0]
- #if defined _samp_included
- #define PROFILE_START(%0); _PROFILE_START(%0)
- #define PROFILE_END(%0);\
- }\
- _PROFILE_END(%0);
- #else
- #define PROFILE_START(%0); _PROFILE_START(%0)
- #define PROFILE_END(%0);\
- }\
- if ((_PROFILE_END(%0)) < 0) {--__i; continue;}
- #endif
- #define CODE_SNIPPET_EXISTS(%0)\
- (sizeof(code_snippets_names) >= ((%0) + 1)) && (defined CodeSnippet%0)
- new code_snippets_time[sizeof(code_snippets_names)] = {0, ...};
- main()
- {
- new __i, __j, __t[sizeof(code_snippets_names)];
- #emit zero.pri
- #emit lctrl 7
- #emit stor.s.pri __i
- #if CODE_SNIPPET_EXISTS(2)
- static const ending[] =
- #if (sizeof(code_snippets_names) <= 4)
- "ка";
- #else
- "ков";
- #endif
- printf(
- "Тестирование: %d отрыв%s кода." LINE_BREAK,
- sizeof(code_snippets_names), ending
- );
- #else
- printf(
- "Тестирование: <%s> vs <%s>" LINE_BREAK,
- code_snippets_names[0], code_snippets_names[1]
- );
- #endif
- static const JIT_status_strings[2][] =
- {"интерпретируемый", "с JIT-компиляцией"};
- printf(
- "Режим: %s, %dx%d итераций.\a" LINE_BREAK,
- JIT_status_strings[__i],
- PROFILER_ITERATIONS_MAJOR, PROFILER_ITERATIONS_MINOR
- );
- Prerequisites();
- for (__i = 0; __i < PROFILER_ITERATIONS_MAJOR; ++__i)
- {
- PROFILE_START(0);
- CodeSnippet0();
- PROFILE_END(0);
- PROFILE_START(1);
- CodeSnippet1();
- PROFILE_END(1);
- #if CODE_SNIPPET_EXISTS(2)
- PROFILE_START(2);
- CodeSnippet2();
- PROFILE_END(2);
- #endif
- #if CODE_SNIPPET_EXISTS(3)
- PROFILE_START(3);
- CodeSnippet3();
- PROFILE_END(3);
- #endif
- #if CODE_SNIPPET_EXISTS(4)
- PROFILE_START(4);
- CodeSnippet4();
- PROFILE_END(4);
- #endif
- #if CODE_SNIPPET_EXISTS(5)
- PROFILE_START(5);
- CodeSnippet5();
- PROFILE_END(5);
- #endif
- #if CODE_SNIPPET_EXISTS(6)
- PROFILE_START(6);
- CodeSnippet6();
- PROFILE_END(6);
- #endif
- #if CODE_SNIPPET_EXISTS(7)
- PROFILE_START(7);
- CodeSnippet7();
- PROFILE_END(7);
- #endif
- #if CODE_SNIPPET_EXISTS(8)
- PROFILE_START(8);
- CodeSnippet8();
- PROFILE_END(8);
- #endif
- #if CODE_SNIPPET_EXISTS(9)
- PROFILE_START(9);
- CodeSnippet9();
- PROFILE_END(9);
- #endif
- #if CODE_SNIPPET_EXISTS(10)
- PROFILE_START(10);
- CodeSnippet10();
- PROFILE_END(10);
- #endif
- #if CODE_SNIPPET_EXISTS(11)
- PROFILE_START(11);
- CodeSnippet11();
- PROFILE_END(11);
- #endif
- #if CODE_SNIPPET_EXISTS(12)
- PROFILE_START(12);
- CodeSnippet12();
- PROFILE_END(12);
- #endif
- #if CODE_SNIPPET_EXISTS(13)
- PROFILE_START(13);
- CodeSnippet13();
- PROFILE_END(13);
- #endif
- #if CODE_SNIPPET_EXISTS(14)
- PROFILE_START(14);
- CodeSnippet14();
- PROFILE_END(14);
- #endif
- #if CODE_SNIPPET_EXISTS(15)
- PROFILE_START(15);
- CodeSnippet15();
- PROFILE_END(15);
- #endif
- for (__j = 0; __j < sizeof(code_snippets_names); ++__j)
- code_snippets_time[__j] += __t[__j];
- }
- for (__i = 0; __i < sizeof(code_snippets_names); ++__i)
- printf(
- "%s: %d" LINE_BREAK,
- code_snippets_names[__i], code_snippets_time[__i]
- );
- printf("\a\a" LINE_BREAK);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement