From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <64ca22ab5ee16ec3a93db27d2b78fbe7@gmx.de> To: 9fans@9fans.net Date: Mon, 23 Mar 2009 00:13:31 +0100 From: cinap_lenrek@gmx.de MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] fossil periodic thread does zero sleep() Topicbox-Message-UUID: c1d5129c-ead4-11e9-9d60-3106f5b1d025 Just noticed that the fsMetaFlush periodic thread in my fossil pushes the syscall count in stats for some time now. Here is no real load on the system and anything else works fine. The questions are: How to print double precisition floating point variables in acid? Can anybody explain this fossil behaviour from the periodic code? I checked that p->msec is 1000 in acid. static void periodicThread(void *a) { Periodic *p = a; double t, ct, ts; vtThreadSetName("periodic"); ct = nsec()*1e-6; t = ct + p->msec; for(;;){ /* skip missed */ while(t <= ct) t += p->msec; ts = t - ct; if(ts > 1000) ts = 1000; sleep(ts); ct = nsec()*1e-6; vtLock(p->lk); if(p->die){ vtUnlock(p->lk); break; } if(t <= ct){ p->f(p->a); t += p->msec; } vtUnlock(p->lk); } periodicFree(p); } Here is the stacktrace: sleep()+0x7 /sys/src/libc/9syscall/sleep.s:5 periodicThread(a=0x8e8a60)+0xc9 /sys/src/cmd/fossil/periodic.c:70 p=0x8e8a60 ct=0x6721cc5a t=0x67601764 ts=0x0 vtThread(rock=0x8e8a60,f=0x23291)+0x30 /sys/src/liboventi/plan9-thread.c:63 periodicAlloc(f=0x14933,a=0x7f690,msec=0x3e8)+0x54 /sys/src/cmd/fossil/periodic.c:30 p=0x8e8a60 fsOpen(mode=0x1,file=0x5ce08,z=0x5ce88,ncache=0x3e8)+0x50f /sys/src/cmd/fossil/fs.c:125 fd=0x9 disk=0x7d4d0 fs=0x7f690 super=0x1 b=0x817f0 oscore=0x7d450 bs=0x5ce88 fsysOpen(argv=0xdfffee88,argc=0x0,name=0x5ca2d)+0x12b /sys/src/cmd/fossil/9fsys.c:1568 usage=0x3e219 ncache=0x3e8 noventi=0x0 wstatallow=0x0 noperm=0x0 noauth=0x0 rflag=0x1 _argc=0xfdf00063 _args=0x3e244 p=0x5ca3e fsys=0x5aa08 fsysXXX(argv=0xdfffee80,name=0x5ca2d,argc=0x3)+0xec /sys/src/cmd/fossil/9fsys.c:1749 i=0x2 r=0x245a8 fsys=0x2449f cmdFsys(argc=0x4,argv=0xdfffee78)+0x13c /sys/src/cmd/fossil/9fsys.c:1813 usage=0x3e399 _argc=0x54d00005 _args=0x32b4a fsys=0x5 cliExec(buf=0x51190)+0xe0 /sys/src/cmd/fossil/Ccli.c:58 p=0x5ca28 argv=0x5ca28 argc=0x5 i=0x8 r=0x1 main(argv=0xdfffef74,argc=0x0)+0x15a /sys/src/cmd/fossil/fossil.c:129 cmd=0x511d0 tflag=0x0 ncmd=0x5 _argc=0x63 _args=0x3e7ab p=0xdfffefba i=0x1 _main+0x31 /sys/src/libc/386/main9.s:16 -- cinap