9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@gmx.de
To: 9fans@9fans.net
Subject: [9fans] fossil periodic thread does zero sleep()
Date: Mon, 23 Mar 2009 00:13:31 +0100	[thread overview]
Message-ID: <64ca22ab5ee16ec3a93db27d2b78fbe7@gmx.de> (raw)

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




             reply	other threads:[~2009-03-22 23:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-22 23:13 cinap_lenrek [this message]
2009-03-22 23:41 ` erik quanstrom
2009-03-23  0:16   ` cinap_lenrek
2009-03-23  0:24     ` erik quanstrom
2009-03-23  0:52       ` cinap_lenrek
2009-03-23  0:54         ` erik quanstrom
2009-03-23  4:04     ` ron minnich
2009-03-23 13:27       ` ron minnich
2009-03-23  0:24   ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64ca22ab5ee16ec3a93db27d2b78fbe7@gmx.de \
    --to=cinap_lenrek@gmx.de \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).