===========================================================================
| 800 | |
| 801 | //=========================================================================== |
| 802 | Update_t CmdProfile (int nArgs) |
| 803 | { |
| 804 | if (! nArgs) |
| 805 | { |
| 806 | strncpy_s( g_aArgs[ 1 ].sArg, g_aParameters[ PARAM_RESET ].m_sName, _TRUNCATE ); |
| 807 | nArgs = 1; |
| 808 | } |
| 809 | |
| 810 | if (nArgs == 1) |
| 811 | { |
| 812 | int iParam; |
| 813 | int nFound = FindParam( g_aArgs[ 1 ].sArg, MATCH_EXACT, iParam, _PARAM_GENERAL_BEGIN, _PARAM_GENERAL_END ); |
| 814 | |
| 815 | if (! nFound) |
| 816 | goto _Help; |
| 817 | |
| 818 | if (iParam == PARAM_RESET) |
| 819 | { |
| 820 | ProfileReset(); |
| 821 | g_bProfiling = 1; |
| 822 | ConsoleBufferPush( " Resetting profile data." ); |
| 823 | } |
| 824 | else |
| 825 | { |
| 826 | if ((iParam != PARAM_SAVE) && (iParam != PARAM_LIST)) |
| 827 | goto _Help; |
| 828 | |
| 829 | bool bExport = true; |
| 830 | if (iParam == PARAM_LIST) |
| 831 | bExport = false; |
| 832 | |
| 833 | // .csv (Comma Seperated Value) |
| 834 | // ProfileFormat( bExport, bExport ? PROFILE_FORMAT_COMMA : PROFILE_FORMAT_SPACE ); |
| 835 | // .txt (Tab Seperated Value) |
| 836 | ProfileFormat( bExport, bExport ? PROFILE_FORMAT_TAB : PROFILE_FORMAT_SPACE ); |
| 837 | |
| 838 | // Dump to console |
| 839 | if (iParam == PARAM_LIST) |
| 840 | { |
| 841 | const int nLine = g_nProfileLine; |
| 842 | |
| 843 | for ( int iLine = 0; iLine < nLine; iLine++ ) |
| 844 | { |
| 845 | ProfileLine_t prfline = ProfileLinePeek( iLine ); |
| 846 | if (prfline.buf) |
| 847 | { |
| 848 | char sText[ CONSOLE_WIDTH ]; |
| 849 | TextConvertTabsToSpaces( sText, prfline.buf, CONSOLE_WIDTH, 4 ); |
| 850 | // ConsoleBufferPush( sText ); |
| 851 | ConsolePrint( sText ); |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | if (iParam == PARAM_SAVE) |
| 857 | { |
| 858 | if (ProfileSave()) |
| 859 | { |
nothing calls this directly
no test coverage detected