Mercurial > blahgd
changeset 17:37f872a9cd36
story: time the rendering
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Wed, 04 Feb 2009 02:31:16 -0500 |
parents | 03eead276f15 |
children | 8c92d95661de |
files | Makefile story.c |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed Feb 04 02:23:27 2009 -0500 +++ b/Makefile Wed Feb 04 02:31:16 2009 -0500 @@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-Wall -g -O2 -std=c99 +CFLAGS=-Wall -g -O2 -std=c99 -D_POSIX_C_SOURCE=199309 -lrt FILES=sar.c post.c xattr.c html.c
--- a/story.c Wed Feb 04 02:23:27 2009 -0500 +++ b/story.c Wed Feb 04 02:31:16 2009 -0500 @@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include "post.h" #include "sar.h" @@ -8,10 +9,13 @@ int main(int argc, char **argv) { + struct timespec s,e; char *path_info; struct post post; int ret; + clock_gettime(CLOCK_REALTIME, &s); + post.out = stdout; fprintf(post.out, "Content-Type: text/html\n\n"); @@ -38,5 +42,10 @@ destroy_post(&post); + clock_gettime(CLOCK_REALTIME, &e); + + fprintf(post.out, "<!-- time to render: %ld.%09ld seconds -->\n", (int)e.tv_sec-s.tv_sec, + e.tv_nsec-s.tv_nsec+((e.tv_sec-s.tv_sec) ? 1000000000 : 0)); + return 0; }