MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / CmdProfile

Function CmdProfile

source/Debugger/Debug.cpp:802–874  ·  view source on GitHub ↗

===========================================================================

Source from the content-addressed store, hash-verified

800
801//===========================================================================
802Update_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 {

Callers

nothing calls this directly

Calls 11

FindParamFunction · 0.85
ProfileResetFunction · 0.85
ProfileFormatFunction · 0.85
ProfileLinePeekFunction · 0.85
TextConvertTabsToSpacesFunction · 0.85
ConsolePrintFunction · 0.85
ProfileSaveFunction · 0.85
ConsoleBufferPushFormatFunction · 0.85
Help_Arg_1Function · 0.85
ConsoleBufferPushFunction · 0.70
ConsoleUpdateFunction · 0.70

Tested by

no test coverage detected