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: Samuel Thibault
Subject: Re: [Fkt-devel] implementing fut_flush
Date: Sun, 25 Mar 2012 18:50:45 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

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



reply via email to

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