fkt-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fkt-devel] implementing fut_flush


From: François Trahay
Subject: Re: [Fkt-devel] implementing fut_flush
Date: Thu, 5 Apr 2012 18:15:36 +0200
User-agent: KMail/1.13.7 (Linux/3.2.0-2-amd64; KDE/4.7.4; x86_64; ; )

Hi,
I've commited fut_flush (including Samuel's remarks) in the repository.
I have also added FUT_START_FLUSH and FUT_STOP_FLUSH events that are recorded 
before and after the flush.

Francois

On Sunday 25 March 2012 18:50:45 Samuel Thibault wrote:
> Hello,
> 
> François Trahay, le Wed 21 Mar 2012 16:58:48 +0100, a écrit :
> > I have implemented an fut_flush function that can be called in this case
> > for flushing the buffer to disk, allowing to record the remaining
> > events.
> 
> That can be useful indeed.
> 
> > +     if(allow_fut_flush) {
> > +       /* flush the buffer to disk and  events */
> > +       /* todo: race condition here ? */
> > +
> > +       fut_active=0;
> > +       /* todo: add this kind of event */
> > +       //FUT_DO_PROBE0(FUT_START_FLUSH_CODE);
> > +       fut_next_slot = prev_slot;
> > +       fut_flush(NULL);
> > +       fut_active=1;
> 
> Stopping trace recording, even for a small amount of time, can be very
> problematic for further analysis, and we need to care about threads.
> I'd say we should rather use a mutex here to make threads wait for flush
> completion, something like
> 
> if (tbx_unlikely(next_slot > fut_last_slot)) {
>       pthread_mutex_lock(&lock);
>       if (fut_next_slot + size > fut_last_slot)
>               /* nobody fixed it in the meanwhile, fixing it ourself */
>               fut_flush(NULL);
>       pthread_mutex_unlock(&lock);
>       goto retry;
> }
> 
> > +  fut_infos->page_size = size;
> > +
> > +  off_t end;
> > +  if( (end=lseek(fut_fd,0,SEEK_CUR)) < 0 ) {
> > +    perror("getting block end seek");
> > +    exit(EXIT_FAILURE);
> > +  }
> 
> It could be useful to somehow call fxt_block too, so that the flushed
> trace is already correct, in case the program crashes later and can't
> manager to call fut_endup.
> 
> Samuel

Attachment: fxt_flush.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]