@@ -13,8 +13,10 @@ using results_vector = std::vector<result_info>;
1313
1414bool extract_cpu_info (ssa text, ssa& res) {
1515 // Найдём, где начинается "Run on ", потом где за ним начинается "\n---"
16+ // Find where "Run on" begins, then where after it "\n---" begins
1617 size_t start = text.find (" Run on " ), end = text.find (" \n ---" , start);
1718 // Если что-то не нашлось - ошибка
19+ // If something was not found - an error
1820 if (start == str::npos || end == str::npos) {
1921 return false ;
2022 }
@@ -34,6 +36,7 @@ struct result_info {
3436 throw std::runtime_error{" Not found cpu info" };
3537 }
3638 // Текущее положение поставим сразу за cpuinfo и откинем завершающие переводы строк
39+ // We will put the current position immediately after cpuinfo and discard the final line feeds
3740 current_text_ = current_text_ (cpu_info_.end () - current_text_.begin () + 1 ).trimmed_right (" \n " );
3841 }
3942};
@@ -57,14 +60,16 @@ stringa get_file_content(stra filePath) {
5760 std::streamsize size = file.tellg ();
5861 file.seekg (0 , std::ios::beg);
5962 // Такой тип удобен для передачи потом в stringa
63+ // This type is convenient for later passing to stringa
6064 lstringsa<0 > result;
6165 file.read (result.set_size (size), size);
6266 result.replace (" \r\n " , " \n " );
63- return result;
67+ return std::move ( result) ;
6468}
6569
6670results_vector get_results_infos () {
6771 // Отберём в директории results все файлы с названиями, заканчивающимися на ".txt" и отсортируем их по имени
72+ // Select all files in the results directory with names ending in ".txt" and sort them by name
6873 const ssa suffix = " .txt" , dirForResults = " results/" ;
6974 std::vector<stringa> fileNames;
7075 for (const auto & f: std::filesystem::directory_iterator{str_to_path (dirForResults)}) {
@@ -88,6 +93,7 @@ results_vector get_results_infos() {
8893 for (const auto & f : fileNames) {
8994 ssa fileName = f;
9095 // В начале имени файла может идти число и дефис, для сортировки, уберём их
96+ // At the beginning of the file name there can be a number and a hyphen, for sorting, remove them
9197 if (auto delimeter = fileName.find (' -' ); delimeter != str::npos && delimeter > 0 ) {
9298 if (std::get<1 >(fileName (0 , delimeter).to_int <unsigned , false , 10 , false , false >()) == IntConvertResult::Success) {
9399 fileName.remove_prefix (delimeter + 1 );
@@ -188,6 +194,7 @@ ssa extract_source_for_benchmark(ssa benchName, ssa sourceText) {
188194 auto [it, not_exist] = textes.try_emplace (benchName);
189195 if (not_exist) {
190196 // Ищем имя функции для этого бенчмарка
197+ // Looking for the name of the function for this benchmark
191198 size_t start = sourceText.find (lstringa<128 >{" ->Name(\" " + e_repl (benchName, " \" " , " \\\" " ) + " \" )" });
192199 if (start == str::npos) {
193200 std::cerr << " Can not found benchmark function name for " << benchName << std::endl;
@@ -204,6 +211,7 @@ ssa extract_source_for_benchmark(ssa benchName, ssa sourceText) {
204211 auto [func_it, not_exist] = textes.try_emplace (funcName);
205212 if (not_exist) {
206213 // Теперь ищем саму эту функцию
214+ // Now we look for this function itself
207215 start = sourceText.find (lstringa<128 >{funcName + " (benchmark::State" });
208216 if (start == str::npos) {
209217 std::cerr << " Can not found source function " << funcName << " for benchmark " << benchName << std::endl;
@@ -218,6 +226,7 @@ ssa extract_source_for_benchmark(ssa benchName, ssa sourceText) {
218226 }
219227 size_t end = -1 ;
220228 // Проверим, возможно там есть переход на другую функцию через //>
229+ // Let's check, maybe there is a transition to another function via //>
221230 ssa prevLine = sourceText.from_to (sourceText.find_last (' \n ' , start - 1 ) + 1 , start);
222231 if (prevLine.starts_with (" //> " )) {
223232 prevLine.remove_prefix (4 );
@@ -262,6 +271,7 @@ void write_benchmarks(out_t& out, const results_vector& results, ssa sourceText,
262271 auto source = extract_source_for_benchmark (benchName, sourceText);
263272 auto comment = extract_comment (commentsText, benchName);
264273 // Нужно вывести название бенча и коммент
274+ // Need to display title and comment
265275 out += " \n <tr><td class=\" benchmarkname\" ><span class=\" tooltip\" >" +
266276 repl_html_symbols (benchName) +
267277 " <span class=\" tooltiptext code\" >" +
@@ -296,18 +306,21 @@ void write_benchmarks(out_t& out, const results_vector& results, ssa sourceText,
296306 continue ;
297307 } else if (line.starts_with (" --" ) && !line.ends_with (" ---" )) {
298308 // Начинается новый набор бенчмарков
309+ // Starts a new set of benchmarks
299310 if (needFooter) {
300311 write_benchset_footer (out, script_text);
301312 }
302313 benchName = extract_name_result (line, result);
303314 // Из названия набора надо удалить начальные и конечные ---
315+ // From the name of the set we need to remove the beginning and end ---
304316 benchName = benchName.from_to (benchName.find (' ' ) + 1 , benchName.find_last (' ' )).trimmed ();
305317 write_benchset_header (out, results, benchName, ++benchSetId);
306318 needFooter = true ;
307319 needCommaForTests = false ;
308320 script_text = " bench_sets['" + e_repl (benchName.to_str (), " '" , " \\ '" ) + " '] = {id:'bs" + benchSetId +" ', tests:[" ;
309321 }
310322 // Эти строки надо пропустить во всех файлах
323+ // These lines must be skipped in all files
311324 for (unsigned idx = 1 ; idx < results.size (); idx++) {
312325 if (splitters[idx].is_done ()) {
313326 std::cerr << " Not expected end of file for " << results[idx].platform_ << std::endl;
0 commit comments