From 610f1778b9d4da641ba3fede8326b78d4088ee93 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 6 May 2022 12:02:31 +0200 Subject: Add profiling for bad region generation --- libcrystfel/src/image.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libcrystfel/src/image.c') diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index 5dccfec6..5d67ae2d 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -903,8 +903,11 @@ static void mark_flagged_pixels(struct panel_template *p, p_h = p->orig_max_ss - p->orig_min_ss + 1; n = p_w * p_h; + profile_start("nan-inf"); mark_flagged_pixels_naninf(dp, bad, n); + profile_end("nan-inf"); + profile_start("flag-values"); for ( i=0; iflag_values[i]; @@ -928,6 +931,7 @@ static void mark_flagged_pixels(struct panel_template *p, } } + profile_end("flag-values"); } @@ -1101,27 +1105,34 @@ static int create_badmap(struct image *image, /* Panel marked as bad? */ if ( p->bad ) { + profile_start("whole-panel"); /* NB this sets every element to 0x1111, * but that's OK - value is still 'true'. */ memset(image->bad[i], 1, p_w*p_h); + profile_end("whole-panel"); } /* Add bad regions (skip if panel is bad anyway) */ if ( !p->bad ) { + profile_start("flagged-pixels"); mark_flagged_pixels(p, image->dp[i], image->bad[i]); + profile_end("flagged-pixels"); } /* Mask panel edges (skip if panel is bad anyway) */ if ( (p->mask_edge_pixels > 0) && !p->bad ) { + profile_start("panel-edges"); mask_panel_edges(image->bad[i], p_w, p_h, p->mask_edge_pixels); + profile_end("panel-edges"); } /* Load masks (skip if panel is bad anyway) */ if ( (!no_mask_data) && (!p->bad) ) { int j; + profile_start("load-masks"); for ( j=0; jmasks[j].bad_bits); } + profile_end("load-masks"); } } + profile_start("mark-regions"); mark_bad_regions(image, dtempl); + profile_end("mark-regions"); return 0; } -- cgit v1.2.3