60 for (
uint32 i = 0; i < 28; ++i)
148 if (first_ed + 1 < 64)
150 if (second_ed + 1 < 64)
212 if (first_ed + 1 < 64)
214 if (second_ed + 1 < 64)
286 if (first_ed < mate->mapped_ed_histogram.size())
299 if (first_ed + 1 < 64)
301 if (second_ed + 1 < 64)
312 std::string file_name = report;
313 char id_name[2048]; sprintf( id_name,
"%u.%s",
id, name );
315 const size_t offset = file_name.find(
".html");
316 file_name.replace( offset+1, file_name.length() - offset - 1, id_name );
317 file_name.append(
".html" );
322 std::string device_file_name(
const char* report,
const uint32 i)
324 std::string file_name = report;
325 char name[32]; sprintf( name,
"%u", i );
327 const size_t offset = file_name.find(
".html");
328 file_name.replace( offset+1, file_name.length() - offset - 1, name );
329 file_name.append(
".html" );
336 const char*
local_file(
const std::string& file_name)
339 const size_t pos = file_name.find_last_of(
"/\\");
341 const size_t pos = file_name.rfind(
'/');
344 if (pos == std::string::npos)
345 return file_name.c_str();
347 return file_name.c_str() + pos + 1u;
350 void add_param(FILE* html_output,
const char* name,
const uint32 val,
bool alt)
352 html::tr_object tr( html_output,
"class", alt ?
"alt" :
"none", NULL );
356 void add_param(FILE* html_output,
const char* name,
const float val,
bool alt)
358 html::tr_object tr( html_output,
"class", alt ?
"alt" :
"none", NULL );
362 void add_param(FILE* html_output,
const char* name,
const char* val,
bool alt)
364 html::tr_object tr( html_output,
"class", alt ?
"alt" :
"none", NULL );
369 void stats_string(
char* buffer,
const uint32 px,
const char* units,
const float v,
const float p,
const float range)
371 sprintf(buffer,
"<span><statnum style=\"width:%upx;\">%.1f %s</statnum> <statbar style=\"width:%.1f%%%%\">\'</statbar></span>", px, v, units, 2.0f + range * p);
381 FILE* html_output = fopen( report,
"w" );
382 if (html_output == NULL)
384 log_warning( stderr,
"unable to write HTML report \"%s\"\n", report );
393 const char* meta_list =
"<meta http-equiv=\"refresh\" content=\"2\" />";
432 char span_string[1024];
443 float global_time = 0.0f;
444 for (
uint32 i = 0; i < n_devices; ++i)
445 global_time += device_stats[i].global_time;
447 for (
uint32 i = 0; i < n_devices; ++i)
449 char link_name[1024];
450 char device_name[64];
451 sprintf( device_name,
"device %u", i );
452 sprintf( link_name,
"<a href=\"%s\">%s</a>",
local_file( device_file_name( report, i ) ), device_name );
453 const char* cls =
"none";
456 stats_string( span_string, 40,
"s", device_stats[i].global_time, device_stats[i].global_time / global_time, 75.0f );
490 uint32 best_bin_val[2] = {0};
495 if (best_bin_val[0] < v)
497 best_bin_val[1] = best_bin_val[0];
498 best_bin[1] = best_bin[0];
502 else if (best_bin_val[1] < v)
514 if (
float(v)/float(n_reads) < 1.0e-3f)
517 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
519 const char* cls = i == best_bin[0] ?
"yellow" : i == best_bin[1] ?
"orange" :
"none";
530 html::table_object table( html_output,
"mapping-quality-stats",
"stats",
"mapping quality stats" );
539 for (
uint32 i = 0; i < 64; ++i)
547 uint64 best_bin_val[2] = {0};
548 for (
uint32 i = 0; i < 7; ++i)
550 if (best_bin_val[0] < bins[i])
552 best_bin_val[1] = best_bin_val[0];
553 best_bin[1] = best_bin[0];
554 best_bin_val[0] = bins[i];
557 else if (best_bin_val[1] < bins[i])
559 best_bin_val[1] = bins[i];
565 for (
uint32 i = 0; i < 7; ++i)
567 const uint32 bin_size = 1u << (i-1);
571 sprintf( buffer,
"%u", i );
572 else if (bin_size < 1024)
573 sprintf( buffer,
"%u - %u", bin_size, bin_size*2-1 );
575 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
577 const char* cls = i == best_bin[0] ?
"yellow" : i == best_bin[1] ?
"orange" :
"none";
586 uint2 best_bin2[2] = { make_uint2(0,0) };
587 uint32 best_bin2_val[2] = { 0 };
589 for (
uint32 i = 1; i <= 16; ++i)
591 for (
uint32 j = 1; j <= 16; ++j)
595 best_bin2_val[1] = best_bin2_val[0];
596 best_bin2[1] = best_bin2[0];
598 best_bin2[0] = make_uint2(i,j);
603 best_bin2[1] = make_uint2(i,j);
609 uint2 best_bin1[2] = { make_uint2(0,0) };
610 uint32 best_bin1_val[2] = { 0 };
612 for (
uint32 i = 0; i <= 16; ++i)
616 best_bin1_val[1] = best_bin1_val[0];
617 best_bin1[1] = best_bin1[0];
619 best_bin1[0] = make_uint2(i,0);
624 best_bin1[1] = make_uint2(i,0);
628 html::table_object table( html_output,
"best2-mapping-stats",
"stats",
"best2 mapping stats" );
632 for (
uint32 i = 0; i <= 16; ++i)
635 for (
uint32 i = 0; i <= 16; ++i)
637 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
640 for (
uint32 j = 0; j <= 16; ++j)
644 if (100.0f *
float(v)/
float(n_reads) >= 0.1f)
646 const char* cls = ((i == best_bin1[0].x && j == best_bin1[0].y) ||
647 (i == best_bin2[0].x && j == best_bin2[0].y)) ?
"yellow" :
648 ((i == best_bin1[1].x && j == best_bin1[1].y) ||
649 (i == best_bin2[1].x && j == best_bin2[1].y)) ?
"orange" :
651 (i+1 == j) ?
"azure" :
"none";
654 else if (100.0f *
float(v)/
float(n_reads) >= 0.01f)
658 const char* cls = (i > params.
max_dist+1 || j > params.
max_dist+1) ?
"gray" :
"none";
668 fclose( html_output );
676 std::vector<KernelStats*> kernel_stats;
677 kernel_stats.push_back( &stats.
map );
678 kernel_stats.push_back( &stats.
select );
679 kernel_stats.push_back( &stats.
sort );
680 kernel_stats.push_back( &stats.
locate );
681 kernel_stats.push_back( &stats.
score );
683 kernel_stats.push_back( &stats.
backtrack );
685 kernel_stats.push_back( &stats.
finalize );
687 kernel_stats.push_back( &stats.
read_HtoD );
688 kernel_stats.push_back( &stats.
read_io );
692 for (
uint32 i = 0; i < kernel_stats.size(); ++i)
696 const std::string device_report = device_file_name( report,
id );
698 FILE* html_output = fopen( device_report.c_str(),
"w" );
699 if (html_output == NULL)
701 log_warning( stderr,
"unable to write HTML report \"%s\"\n", device_report.c_str() );
711 const char* meta_list =
"<meta http-equiv=\"refresh\" content=\"2\" />";
721 char span_string[1024];
724 float worst_time[2] = {0};
727 for (
uint32 i = 0; i < kernel_stats.size(); ++i)
729 const float time = kernel_stats[i]->time;
731 if (worst_time[0] < time)
733 worst_time[1] = worst_time[0];
735 worst_time[0] = time;
738 else if (worst_time[1] < time)
740 worst_time[1] = time;
758 for (
uint32 i = 0; i < kernel_stats.size(); ++i)
761 const char* name = kstats.
name.c_str();
762 const char* units = kstats.
units.c_str();
765 char link_name[1024];
766 sprintf( link_name,
"<a href=\"%s\">%s</a>",
local_file( file_name ), name );
767 const char* cls = worst[0] == i ?
"yellow" : worst[1] == i ?
"orange" :
"none";
803 uint32 best_bin_val[2] = {0};
808 if (best_bin_val[0] < v)
810 best_bin_val[1] = best_bin_val[0];
811 best_bin[1] = best_bin[0];
815 else if (best_bin_val[1] < v)
827 if (
float(v)/float(n_reads) < 1.0e-3f)
830 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
832 const char* cls = i == best_bin[0] ?
"yellow" : i == best_bin[1] ?
"orange" :
"none";
842 html::table_object table( html_output,
"mapping-quality-stats",
"stats",
"mapping quality stats" );
851 for (
uint32 i = 0; i < 64; ++i)
859 uint64 best_bin_val[2] = {0};
860 for (
uint32 i = 0; i < 7; ++i)
862 if (best_bin_val[0] < bins[i])
864 best_bin_val[1] = best_bin_val[0];
865 best_bin[1] = best_bin[0];
866 best_bin_val[0] = bins[i];
869 else if (best_bin_val[1] < bins[i])
871 best_bin_val[1] = bins[i];
877 for (
uint32 i = 0; i < 7; ++i)
879 const uint32 bin_size = 1u << (i-1);
883 sprintf( buffer,
"%u", i );
884 else if (bin_size < 1024)
885 sprintf( buffer,
"%u - %u", bin_size, bin_size*2-1 );
887 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
889 const char* cls = i == best_bin[0] ?
"yellow" : i == best_bin[1] ?
"orange" :
"none";
898 uint2 best_bin2[2] = { make_uint2(0,0) };
899 uint32 best_bin2_val[2] = { 0 };
901 for (
uint32 i = 1; i <= 16; ++i)
903 for (
uint32 j = 1; j <= 16; ++j)
907 best_bin2_val[1] = best_bin2_val[0];
908 best_bin2[1] = best_bin2[0];
910 best_bin2[0] = make_uint2(i,j);
915 best_bin2[1] = make_uint2(i,j);
921 uint2 best_bin1[2] = { make_uint2(0,0) };
922 uint32 best_bin1_val[2] = { 0 };
924 for (
uint32 i = 0; i <= 16; ++i)
928 best_bin1_val[1] = best_bin1_val[0];
929 best_bin1[1] = best_bin1[0];
931 best_bin1[0] = make_uint2(i,0);
936 best_bin1[1] = make_uint2(i,0);
940 html::table_object table( html_output,
"best2-mapping-stats",
"stats",
"best2 mapping stats" );
944 for (
uint32 i = 0; i <= 16; ++i)
947 for (
uint32 i = 0; i <= 16; ++i)
949 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
952 for (
uint32 j = 0; j <= 16; ++j)
956 if (100.0f *
float(v)/
float(n_reads) >= 0.1f)
958 const char* cls = ((i == best_bin1[0].x && j == best_bin1[0].y) ||
959 (i == best_bin2[0].x && j == best_bin2[0].y)) ?
"yellow" :
960 ((i == best_bin1[1].x && j == best_bin1[1].y) ||
961 (i == best_bin2[1].x && j == best_bin2[1].y)) ?
"orange" :
963 (i+1 == j) ?
"azure" :
"none";
966 else if (100.0f *
float(v)/
float(n_reads) >= 0.01f)
991 uint64 hits_top_bins_sum = 0;
992 for (
uint32 i = 0; i < 28; ++i)
994 hits_bins_sum += hits_bins[i] = stats.
hits_bins[i];
995 hits_top_bins_sum += hits_top_bins[i] = stats.
hits_top_bins[i];
1033 uint32 best_bin[2] = {0};
1034 uint64 best_bin_val[2] = {0};
1035 uint32 best_top_bin[2] = {0};
1036 uint64 best_top_bin_val[2] = {0};
1037 for (
uint32 i = 0; i < 28; ++i)
1039 max_bin = float(hits_bins[i]) / float(hits_bins_sum) > 0.001f ? i : max_bin;
1040 max_bin = float(hits_top_bins[i]) / float(hits_top_bins_sum) > 0.001f ? i : max_bin;
1042 if (best_bin_val[0] < hits_bins[i])
1044 best_bin_val[1] = best_bin_val[0];
1045 best_bin[1] = best_bin[0];
1046 best_bin_val[0] = hits_bins[i];
1049 else if (best_bin_val[1] < hits_bins[i])
1051 best_bin_val[1] = hits_bins[i];
1055 if (best_top_bin_val[0] < hits_top_bins[i])
1057 best_top_bin_val[1] = best_top_bin_val[0];
1058 best_top_bin[1] = best_top_bin[0];
1059 best_top_bin_val[0] = hits_top_bins[i];
1060 best_top_bin[0] = i;
1062 else if (best_top_bin_val[1] < hits_top_bins[i])
1064 best_top_bin_val[1] = hits_top_bins[i];
1065 best_top_bin[1] = i;
1068 for (
uint32 i = 0; i < max_bin; ++i)
1070 const uint32 bin_size = 1u << (i-1);
1072 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
1074 sprintf( buffer,
"%u", i );
1075 else if (bin_size < 512)
1076 sprintf( buffer,
"%u - %u", bin_size, bin_size*2-1 );
1077 else if (bin_size == 512)
1078 sprintf( buffer,
"0.5K - 1K" );
1080 sprintf( buffer,
"%uK - %uK", bin_size/1024, bin_size*2/1024 );
1082 const char* cls = i == best_bin[0] ?
"yellow" : i == best_bin[1] ?
"orange" :
"none";
1083 const char* cls_top = i == best_top_bin[0] ?
"yellow" : i == best_top_bin[1] ?
"orange" :
"none";
1087 html::td_object( html_output,
html::FORMATTED,
"class", cls_top, NULL,
"%4.1f %%", 100.0f *
float(hits_top_bins[i]) /
float(hits_top_bins_sum) );
1095 fclose( html_output );
1098 template <
typename T>
1101 best_bin[0] = best_bin[1] = 0;
1102 T best_bin_val[2] = {0};
1103 for (
uint32 i = 0; i < n; ++i)
1105 if (best_bin_val[0] < table[i])
1107 best_bin_val[1] = best_bin_val[0];
1108 best_bin[1] = best_bin[0];
1109 best_bin_val[0] = table[i];
1112 else if (best_bin_val[1] < table[i])
1114 best_bin_val[1] = table[i];
1122 const char* name = stats.
name.c_str();
1123 const char* units = stats.
units.c_str();
1126 const std::deque< std::pair<uint32,float> >& table = stats.
info;
1128 FILE* html_output = fopen( file_name.c_str(),
"w" );
1129 if (html_output == NULL)
1131 log_warning( stderr,
"unable to write HTML report \"%s\"\n", file_name.c_str() );
1138 const char* meta_list =
"<meta http-equiv=\"refresh\" content=\"2\" />";
1148 uint32 bin_calls[32] = {0};
1149 float bin_sum_time[32] = {0.0f};
1150 float bin_avg_time[32] = {0.0f};
1151 float bin_speed[32] = {0.0f};
1153 float total_time = stats.
time;
1154 float avg_speed = total_time ? float(
double(stats.
calls) /
double(stats.
time)) : 0.0f;
1155 float max_speed = 0.0f;
1157 for (
uint32 bin = 0; bin < 32; ++bin)
1160 bin_sum_time[bin] = stats.
bin_time[bin];
1165 max_speed =
std::max( max_speed, bin_speed[bin] );
1170 sprintf( buffer1,
"%s-summary-stats", name );
1171 sprintf( buffer2,
"%s summary stats", name );
1179 for (
uint32 i = 0; i < 32; ++i)
1203 find_gt2( 32, bin_avg_time, best_avg_bin );
1204 find_gt2( 32, bin_sum_time, best_sum_bin );
1206 float cum_time = 0.0f;
1208 float max_avg_time = 0.0f;
1209 float max_sum_time = 0.0f;
1210 for (
uint32 i = 0; i < 32; ++i)
1212 max_avg_time =
nvbio::max( bin_avg_time[i], max_avg_time );
1213 max_sum_time =
nvbio::max( bin_sum_time[i], max_sum_time );
1216 char span_string[1024];
1217 for (
uint32 i = 0; i < 32; ++i)
1219 if (bin_calls[i] == 0)
1222 const float speed = bin_speed[i];
1224 cum_time += bin_sum_time[i];
1226 const uint32 bin_size = 1u << i;
1227 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
1230 else if (bin_size < 512)
1232 else if (bin_size == 512)
1234 else if (bin_size < 512*1024)
1236 else if (bin_size == 512*1024)
1239 const char* avg_cls = i == best_avg_bin[0] ?
"yellow" : i == best_avg_bin[1] ?
"orange" :
"none";
1240 const char* sum_cls = i == best_sum_bin[0] ?
"yellow" : i == best_sum_bin[1] ?
"orange" :
"none";
1241 const char* spd_cls = speed == max_speed ?
"yellow" : speed < avg_speed * 0.1f ?
"red" : speed < max_speed * 0.1f ?
"pink" :
"none";
1244 stats_string( span_string, 60,
"ms", 1000.0f * bin_avg_time[i], bin_avg_time[i] / max_avg_time, 50.0f );
1246 stats_string( span_string, 60,
"ms", 1000.0f * bin_sum_time[i], bin_sum_time[i] / max_sum_time, 50.0f );
1249 html::td_object( html_output,
html::FORMATTED,
"class", spd_cls, NULL,
"%.1f %c %s/s", speed * (speed >= 1.0e6f ? 1.0e-6f : 1.0e-3f), speed >= 1.0e6f ?
'M' :
'K', units );
1258 sprintf( buffer1,
"%s-stats", name );
1259 sprintf( buffer2,
"%s stats", name );
1268 uint32 best_bin[2] = {0};
1269 float best_bin_val[2] = {0};
1270 for (
uint32 i = 0; i < table.size(); ++i)
1272 if (best_bin_val[0] < table[i].second)
1274 best_bin_val[1] = best_bin_val[0];
1275 best_bin[1] = best_bin[0];
1276 best_bin_val[0] = table[i].second;
1279 else if (best_bin_val[1] < table[i].second)
1281 best_bin_val[1] = table[i].second;
1286 float max_time = 0.0f;
1287 float max_speed = 0.0f;
1288 for (
uint32 i = 0; i < table.size(); ++i)
1290 const float speed = float(table[i].first) / table[i].second;
1291 max_time =
nvbio::max(
float(table[i].second), max_time );
1295 char span_string[1024];
1296 char units_string[1024];
1297 for (
uint32 i = 0; i < table.size(); ++i)
1299 const float speed = float(table[i].first) / table[i].second;
1300 html::tr_object tr( html_output,
"class", i % 2 ?
"none" :
"alt", NULL );
1302 const char* cls = i == best_bin[0] ?
"yellow" : i == best_bin[1] ?
"orange" :
"none";
1303 html::td_object( html_output,
html::FORMATTED, NULL,
"%.1f %c",
float(table[i].first) * (table[i].first > 1000000 ? 1.0e-6f : 1.0e-3f), table[i].first > 1000000 ?
'M' :
'K' );
1304 stats_string( span_string, 50,
"ms", 1000.0f *
float(table[i].second),
float(table[i].second) / max_time, 50.0f );
1306 sprintf(units_string,
"%c %s/s", speed > 1000000 ?
'M' :
'K', units );
1307 stats_string( span_string, 100, units_string, speed * (speed >= 1.0e6f ? 1.0e-6f : 1.0e-3f), speed / max_speed, 50.0f );
1314 fclose( html_output );