X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Fpages.c;h=50a652c5946a02ffd1a82fc60780e19620217dbf;hb=27ae0b4c6d571104f553d5bf863998fd478feb45;hp=cdf7c05b41999e82190047b36ab524c3944cfa50;hpb=87f7f25f01e3c0af51cce64fb7f93dd7b0d0861a;p=ypp-sc-tools.db-test.git diff --git a/pctb/pages.c b/pctb/pages.c index cdf7c05..50a652c 100644 --- a/pctb/pages.c +++ b/pctb/pages.c @@ -228,9 +228,9 @@ static void compute_shift_mask(ShMask *sm, unsigned long ximage_mask) { assert(sm->rshift < LONG_BIT); } -static void rtimestamp(double *t) { +static void rtimestamp(double *t, const char *wh) { double n= timestamp(); - debugf("PAGING INTERVAL %f\n", n-*t); + debugf("PAGING INTERVAL %f %s\n", n-*t, wh); *t= n; } @@ -243,13 +243,20 @@ static void snapshot(Snapshot **output) { double begin= timestamp(); if (shmim) { - im_use= shmim; xassert( XShmGetImage(disp,id,shmim, 0,0, AllPlanes) ); + rtimestamp(&begin, "XShmGetImage"); + + size_t dsz= shmim->bytes_per_line * shmim->height; + im_use= im_free= mmalloc(sizeof(*im_use) + dsz); + *im_free= *shmim; + im_free->data= (void*)(im_free+1); + memcpy(im_free->data, shmim->data, dsz); + rtimestamp(&begin, "mmalloc/memcpy"); } else { xassert( im_use= im_free= XGetImage(disp,id, 0,0, wwidth,wheight, AllPlanes, ZPixmap) ); + rtimestamp(&begin, "XGetImage"); } - rtimestamp(&begin); #define COMPUTE_SHIFT_MASK(ix, rgb) \ compute_shift_mask(&shiftmasks[ix], im_use->rgb##_mask) @@ -260,12 +267,12 @@ static void snapshot(Snapshot **output) { if (!*output) *output= alloc_rgb_image(wwidth, wheight); - rtimestamp(&begin); + rtimestamp(&begin, "compute_shift_masks+alloc_rgb_image"); int x,y,i; unsigned char *op= (*output)->data; - for (y=0; y