@@ -1156,37 +1156,40 @@ TEST_F(RecordNodeBenchmark, BatchWrite_vs_PerChannel_Interleave_384ch)
11561156 {
11571157 auto tempFile = parentRecordingDir / (" bench_perchan_" + std::to_string (iter) + " .dat" );
11581158
1159- SequentialBlockFile blockFile (channels, 4096 );
1160- blockFile.openFile (tempFile.string ());
1161-
1162- auto startTime = high_resolution_clock::now ();
1163-
1164- for (int ch = 0 ; ch < channels; ch++)
11651159 {
1166- blockFile.writeChannel (0 , ch, channelPtrs[ch], samples);
1160+ SequentialBlockFile blockFile (channels, 4096 );
1161+ blockFile.openFile (tempFile.string ());
1162+
1163+ auto startTime = high_resolution_clock::now ();
1164+
1165+ for (int ch = 0 ; ch < channels; ch++)
1166+ {
1167+ blockFile.writeChannel (0 , ch, channelPtrs[ch], samples);
1168+ }
1169+
1170+ auto endTime = high_resolution_clock::now ();
1171+ perChannelTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
11671172 }
1168-
1169- auto endTime = high_resolution_clock::now ();
1170- perChannelTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
1171-
1173+
11721174 std::filesystem::remove (tempFile);
11731175 }
11741176
11751177 // Batch benchmark
11761178 for (int iter = 0 ; iter < iterations; iter++)
11771179 {
11781180 auto tempFile = parentRecordingDir / (" bench_batch_" + std::to_string (iter) + " .dat" );
1179-
1180- SequentialBlockFile blockFile (channels, 4096 );
1181- blockFile.openFile (tempFile.string ());
1182-
1183- auto startTime = high_resolution_clock::now ();
1184-
1185- blockFile.writeChannelBatch (0 , channelPtrs.data (), channels, samples);
1186-
1187- auto endTime = high_resolution_clock::now ();
1188- batchTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
1189-
1181+ {
1182+ SequentialBlockFile blockFile (channels, 4096 );
1183+ blockFile.openFile (tempFile.string ());
1184+
1185+ auto startTime = high_resolution_clock::now ();
1186+
1187+ blockFile.writeChannelBatch (0 , channelPtrs.data (), channels, samples);
1188+
1189+ auto endTime = high_resolution_clock::now ();
1190+ batchTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
1191+ }
1192+
11901193 std::filesystem::remove (tempFile);
11911194 }
11921195
@@ -1237,37 +1240,39 @@ TEST_F(RecordNodeBenchmark, BatchWrite_vs_PerChannel_Interleave_768ch)
12371240 for (int iter = 0 ; iter < iterations; iter++)
12381241 {
12391242 auto tempFile = parentRecordingDir / (" bench_perchan_768_" + std::to_string (iter) + " .dat" );
1240-
1241- SequentialBlockFile blockFile (channels, 4096 );
1242- blockFile.openFile (tempFile.string ());
1243-
1244- auto startTime = high_resolution_clock::now ();
1245-
1246- for (int ch = 0 ; ch < channels; ch++)
12471243 {
1248- blockFile.writeChannel (0 , ch, channelPtrs[ch], samples);
1244+ SequentialBlockFile blockFile (channels, 4096 );
1245+ blockFile.openFile (tempFile.string ());
1246+
1247+ auto startTime = high_resolution_clock::now ();
1248+
1249+ for (int ch = 0 ; ch < channels; ch++)
1250+ {
1251+ blockFile.writeChannel (0 , ch, channelPtrs[ch], samples);
1252+ }
1253+
1254+ auto endTime = high_resolution_clock::now ();
1255+ perChannelTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
12491256 }
1250-
1251- auto endTime = high_resolution_clock::now ();
1252- perChannelTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
1253-
1257+
12541258 std::filesystem::remove (tempFile);
12551259 }
12561260
12571261 for (int iter = 0 ; iter < iterations; iter++)
12581262 {
12591263 auto tempFile = parentRecordingDir / (" bench_batch_768_" + std::to_string (iter) + " .dat" );
1260-
1261- SequentialBlockFile blockFile (channels, 4096 );
1262- blockFile.openFile (tempFile.string ());
1263-
1264- auto startTime = high_resolution_clock::now ();
1265-
1266- blockFile.writeChannelBatch (0 , channelPtrs.data (), channels, samples);
1267-
1268- auto endTime = high_resolution_clock::now ();
1269- batchTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
1270-
1264+ {
1265+ SequentialBlockFile blockFile (channels, 4096 );
1266+ blockFile.openFile (tempFile.string ());
1267+
1268+ auto startTime = high_resolution_clock::now ();
1269+
1270+ blockFile.writeChannelBatch (0 , channelPtrs.data (), channels, samples);
1271+
1272+ auto endTime = high_resolution_clock::now ();
1273+ batchTimeMs += duration_cast<microseconds>(endTime - startTime).count () / 1000.0 ;
1274+ }
1275+
12711276 std::filesystem::remove (tempFile);
12721277 }
12731278
0 commit comments