Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2012 00:22:10 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 219907 for review
Message-ID:  <201212140022.qBE0MADn069288@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@219907?ac=10

Change 219907 by brooks@brooks_zenith on 2012/12/14 00:21:24

	Total up the time take to render a composite slide and print it
	out in the verbose case.
	
	Remove an extra variable name left from a previous code flow.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#20 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#20 (text+ko) ====

@@ -450,9 +450,11 @@
 	char sntext[8];
 	uint32_t *snimage;
 	uint32_t r;
-	struct iboxstate *is, *hdris;
+	uint64_t decode, total;
+	struct iboxstate *is;
 
 	error = 0;
+	decode = total = 0;
 
 	busy(1);
 
@@ -473,6 +475,8 @@
 		warnx("png_read_finish() failed for %s", slide);
 		return (-1);
 	}
+	decode += iboxstate_get_dtime(is);
+	total += iboxstate_get_ttime(is);
 	fb_fill_region(white, 0, 0, fb_width, fb_height);
 	busy(0);
 	/*
@@ -558,6 +562,8 @@
 		warnx("png_read_finish() failed for sri.png");
 		return (-1);
 	}
+	decode += iboxstate_get_dtime(is);
+	total += iboxstate_get_ttime(is);
 	fb_post_region(__DEVOLATILE(uint32_t *, is->buffer),
 	    slide_fcol, fb_height - is->height, is->width, is->height);
 	if (sb_vis && sb != SB_NONE)
@@ -578,6 +584,8 @@
 		warnx("png_read_finish() failed for ucam.png");
 		return (-1);
 	}
+	decode += iboxstate_get_dtime(is);
+	total += iboxstate_get_ttime(is);
 	fb_post_region(__DEVOLATILE(uint32_t *, is->buffer),
 	    slide_fcol + slide_width - is->width, fb_height - is->height,
 	    is->width, is->height);
@@ -613,28 +621,33 @@
 		warn("Failed to open header.png");
 		return (-1);
 	}
-	if ((hdris = png_read_start(pfd, slide_width, fb_height, sb)) == NULL) {
+	if ((is = png_read_start(pfd, slide_width, fb_height, sb)) == NULL) {
 		warn("Failed to start PNG decode for header.png");
 		return (-1);
 	}
-	if (png_read_finish(hdris) != 0) {
+	if (png_read_finish(is) != 0) {
 		warnx("png_read_finish() failed for header.png");
 		return (-1);
 	}
+	decode += iboxstate_get_dtime(is);
+	total += iboxstate_get_ttime(is);
 	/* Fill in the header's background. */
-	for (r = 0; r < hdris->height; r++)
-		fb_fill_region(hdris->buffer[r * hdris->width], 0, r,
+	for (r = 0; r < is->height; r++)
+		fb_fill_region(is->buffer[r * is->width], 0, r,
 		fb_width, 1);
-	fb_post_region(__DEVOLATILE(uint32_t *, hdris->buffer),
-	    slide_fcol + slide_width - hdris->width, 0, hdris->width,
-	    hdris->height);
+	fb_post_region(__DEVOLATILE(uint32_t *, is->buffer),
+	    slide_fcol + slide_width - is->width, 0, is->width, is->height);
 	if (sb_vis && sb != SB_NONE)
-		fb_rectangle(red, 2, slide_fcol + slide_width - hdris->width,
-		    0, hdris->width, hdris->height);
-	iboxstate_free(hdris);
+		fb_rectangle(red, 2, slide_fcol + slide_width - is->width,
+		    0, is->width, is->height);
+	iboxstate_free(is);
 
 	unbusy();
 
+	if (verbose)
+		printf("total: %ju  decode: %ju  overhead: %.1f%%\n", total,
+		    decode, 100.0 * (((float)total - decode) / total));
+
 	return (error);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212140022.qBE0MADn069288>