@@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2828
2929// = NAMESPACES ===============
3030using namespace std ;
31+ using namespace filesystem ;
3132// ============================
3233
3334namespace spartan
@@ -36,14 +37,13 @@ namespace spartan
3637 {
3738 constexpr const char * file_path_name = " data/profiling/ProfilingReport.csv" ;
3839
39- std::ofstream csv_export_file;
40- filesystem::path file_path (file_path_name);
41- int current_mode_hardware = 0 ;
42- int current_csv_col = 0 ; // frames by columns
43- int current_csv_row = 0 ; // frame data by row
40+ ofstream csv_export_file;
41+ path file_path (file_path_name);
42+ int current_csv_col = 0 ; // frames by columns
43+ int current_csv_row = 0 ; // frame data by row
4444 }
4545
46- void CsvExporter::StartRecording (int mode_hardware )
46+ void CsvExporter::StartRecording ()
4747 {
4848 if (csv_export_file.is_open ())
4949 {
@@ -55,11 +55,10 @@ namespace spartan
5555 {
5656 if (file_path.has_parent_path ())
5757 {
58- filesystem:: create_directories (file_path.parent_path ());
58+ create_directories (file_path.parent_path ());
5959 }
6060
61- csv_export_file.exceptions (std::ofstream::failbit | std::ofstream::badbit);
62-
61+ csv_export_file.exceptions (ofstream::failbit | ofstream::badbit);
6362 csv_export_file.open (file_path, ios::out | ios::trunc);
6463
6564 if (current_csv_col == 0 )
@@ -68,11 +67,10 @@ namespace spartan
6867 csv_export_file.flush ();
6968 current_csv_col++;
7069 }
71- current_mode_hardware = mode_hardware;
7270
73- SP_LOG_INFO (" Started recording %s data for CSV report: %s" , current_mode_hardware == 0 ? " GPU " : " CPU " , file_path.generic_string ().c_str ());
71+ SP_LOG_INFO (" Started recording profiling data for CSV report: %s" , file_path.generic_string ().c_str ());
7472 }
75- catch (const filesystem:: filesystem_error& e) // directory creation failures
73+ catch (const filesystem_error& e) // directory creation failures
7674 {
7775 SP_LOG_ERROR (" Filesystem Error: %s" , e.what ());
7876 }
@@ -88,7 +86,8 @@ namespace spartan
8886 {
8987 if (current_csv_row == 0 )
9088 {
91- csv_export_file << current_time_block.GetName () << " ," ;
89+ const char * hardware_type = current_time_block.GetType () == TimeBlockType::Gpu ? " GPU" : " CPU" ;
90+ csv_export_file << hardware_type << " /" << current_time_block.GetName () << " ," ;
9291 return ;
9392 }
9493 if (current_csv_col == 0 )
@@ -103,7 +102,7 @@ namespace spartan
103102 }
104103 }
105104
106- void CsvExporter::NextFrame ()
105+ void CsvExporter::NextInterval ()
107106 {
108107 if (csv_export_file.is_open ())
109108 {
@@ -113,24 +112,17 @@ namespace spartan
113112 }
114113 }
115114
116- void CsvExporter::StopRecording (bool has_data_changed )
115+ void CsvExporter::StopRecording ()
117116 {
118117 if (csv_export_file.is_open ())
119118 {
120119 csv_export_file.flush ();
121120 csv_export_file.close ();
122121 current_csv_col = 0 ;
123122 current_csv_row = 0 ;
124- if (has_data_changed)
125- {
126- SP_LOG_WARNING (" Stopped recording data for CSV report %s. Time block data were modified." , file_path.generic_string ().c_str ());
127- }
128- else
129- {
130- SP_LOG_INFO (" Stopped recording %s data for CSV report: %s" , current_mode_hardware == 0 ? " GPU" : " CPU" , file_path.generic_string ().c_str ());
131- }
123+ SP_LOG_INFO (" Stopped recording profiling data for CSV report: %s" , file_path.generic_string ().c_str ());
132124 }
133- else if (!csv_export_file.is_open () && !has_data_changed )
125+ else if (!csv_export_file.is_open ())
134126 {
135127 SP_LOG_WARNING (" Invalid action. There is no active CSV recording." );
136128 }
0 commit comments