@@ -623,7 +623,7 @@ void TimeStats::sumWith( const TimeStats* pOther )
623623
624624 m_PassTotalTicks += pOther->m_PassTotalTicks ;
625625
626- if (IGC::Debug::GetDebugFlag (IGC::Debug::DebugFlag:: TIME_STATS_PER_PASS))
626+ if (IGC_REGKEY_OR_FLAG_ENABLED (DumpTimeStatsPerPass, TIME_STATS_PER_PASS))
627627 {
628628 if (m_PassTimeStatsMap.empty ())
629629 {
@@ -681,9 +681,17 @@ void TimeStats::printTime( ShaderType type, ShaderHash hash, void* context ) con
681681
682682void TimeStats::printSumTime () const
683683{
684+ // If using regkey to turn on timestats, CorpusName is not initialized properly
685+ if (strlen (IGC::Debug::GetShaderCorpusName ()) == 0 )
686+ {
687+ std::stringstream corpusName;
688+ corpusName << m_totalShaderCount << " shaders" ;
689+ IGC::Debug::SetShaderCorpusName (corpusName.str ().c_str ());
690+ }
691+
684692 TimeStats pp = postProcess ();
685693
686- bool dumpCoarse = IGC::Debug::GetDebugFlag (IGC::Debug::DebugFlag::TIME_STATS_COARSE );
694+ bool dumpCoarse = IGC_REGKEY_OR_FLAG_ENABLED (DumpTimeStatsCoarse, TIME_STATS_COARSE );
687695
688696 if ( dumpCoarse )
689697 {
@@ -694,7 +702,7 @@ void TimeStats::printSumTime() const
694702 pp.printSumTimeCSV (" c:\\ Intel\\ TimeStatSum.csv" );
695703 }
696704
697- if (IGC::Debug::GetDebugFlag (IGC::Debug::DebugFlag:: TIME_STATS_PER_PASS))
705+ if (IGC_REGKEY_OR_FLAG_ENABLED (DumpTimeStatsPerPass, TIME_STATS_PER_PASS))
698706 {
699707 pp.printPerPassSumTime (llvm::dbgs ());
700708 pp.printPerPassSumTimeCSV (" c:\\ Intel\\ TimeStatPerPassSum.csv" );
@@ -706,7 +714,7 @@ void TimeStats::printSumTime() const
706714bool TimeStats::skipTimer ( int i ) const
707715{
708716 const COMPILE_TIME_INTERVALS interval = static_cast <COMPILE_TIME_INTERVALS>(i);
709- if ( IGC::Debug::GetDebugFlag (IGC::Debug::DebugFlag:: TIME_STATS_COARSE ) && !isCoarseTimer ( interval ) )
717+ if ( IGC_REGKEY_OR_FLAG_ENABLED (DumpTimeStatsCoarse, TIME_STATS_COARSE ) && !isCoarseTimer ( interval ) )
710718 {
711719 return true ;
712720 }
@@ -759,7 +767,7 @@ void TimeStats::printSumTimeCSV(const char* outputFile) const
759767 }
760768 fprintf (fileName, " \n " );
761769
762- if ( !IGC::Debug::GetDebugFlag (IGC::Debug::DebugFlag::TIME_STATS_COARSE ) )
770+ if ( !IGC_REGKEY_OR_FLAG_ENABLED (DumpTimeStatsCoarse, TIME_STATS_COARSE) )
763771 {
764772 // print secs
765773 fprintf (fileName, " seconds,," );
@@ -934,7 +942,7 @@ void TimeStats::printSumTimeTable( llvm::raw_ostream & OS ) const
934942 FS << " \n " ;
935943
936944 // table body
937- if (IGC::Debug::GetDebugFlag (IGC::Debug::DebugFlag:: TIME_STATS_COARSE))
945+ if (IGC_REGKEY_OR_FLAG_ENABLED (DumpTimeStatsCoarse, TIME_STATS_COARSE))
938946 {
939947 uint64_t timeNotInCoarse = getCompileTime (TIME_TOTAL);
940948 for (int i = 0 ; i < MAX_COMPILE_TIME_INTERVALS; i++)
@@ -1049,7 +1057,12 @@ void TimeStats::printTimeCSV( std::string const& corpusName ) const
10491057{
10501058 IGC_ASSERT_MESSAGE (m_isPostProcessed, " Print functions should only be called on a Post-Processed TimeStats object" );
10511059
1052- const std::string outputFilePath = std::string (" c:\\ Intel\\ " ) + " TimeStat_" + IGC::Debug::GetShaderCorpusName () + " .csv" ;
1060+ std::string subFile = " TimeStat_" ;
1061+ if (strlen (IGC::Debug::GetShaderCorpusName ()) == 0 )
1062+ subFile += " Shaders" ;
1063+ else
1064+ subFile += IGC::Debug::GetShaderCorpusName ();
1065+ const std::string outputFilePath = std::string (" c:\\ Intel\\ " ) + subFile + " .csv" ;
10531066 const char *outputFile = outputFilePath.c_str ();
10541067
10551068 bool fileExist = false ;
@@ -1103,7 +1116,12 @@ void TimeStats::printPerPassTimeCSV(std::string const& corpusName) const
11031116 return ;
11041117 }
11051118
1106- const std::string outputFilePath = std::string (" c:\\ Intel\\ " ) + " TimeStatPerPass_" + IGC::Debug::GetShaderCorpusName () + " .csv" ;
1119+ std::string subFile = " TimeStatPerPass_" ;
1120+ if (strlen (IGC::Debug::GetShaderCorpusName ()) == 0 )
1121+ subFile += " Shaders" ;
1122+ else
1123+ subFile += IGC::Debug::GetShaderCorpusName ();
1124+ const std::string outputFilePath = std::string (" c:\\ Intel\\ " ) + subFile + " .csv" ;
11071125 const char * outputFile = outputFilePath.c_str ();
11081126 bool fileExist = false ;
11091127
0 commit comments