pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret.c,v 1.348 2004/04/06 13:00:42 nilsson Exp $ + || $Id: interpret.c,v 1.349 2004/05/21 16:30:16 grubba Exp $   */      #include "global.h" - RCSID("$Id: interpret.c,v 1.348 2004/04/06 13:00:42 nilsson Exp $"); + RCSID("$Id: interpret.c,v 1.349 2004/05/21 16:30:16 grubba Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "pike_error.h"   #include "stralloc.h"   #include "constants.h"   #include "pike_macros.h"
pike.git/src/interpret.c:1790:       }    if(Pike_interpreter.trace_level>1)    do_trace_func_return (1, o, fun);    }    return 0;   }          - #define low_return_profiling() -  - #ifdef PROFILING - #ifdef HAVE_GETHRTIME - #undef low_return_profiling - #define low_return_profiling() do { \ -  struct identifier *function; \ -  long long time_passed, time_in_children, self_time; \ -  time_in_children=Pike_interpreter.accounted_time-Pike_fp->children_base; \ -  time_passed = gethrtime()-Pike_interpreter.time_base - Pike_fp->start_time; \ -  self_time=time_passed - time_in_children; \ -  Pike_interpreter.accounted_time+=self_time; \ -  function = Pike_fp->context.prog->identifiers + Pike_fp->ident; \ -  function->total_time=Pike_fp->self_time_base + (INT32)(time_passed /1000); \ -  function->self_time+=(INT32)( self_time /1000); \ - }while(0) - #endif - #endif -  -  +    #define basic_low_return(save_sp) \    DO_IF_DEBUG( \    if(Pike_mark_sp < Pike_fp->save_mark_sp) \    Pike_fatal("Popped below save_mark_sp!\n"); \    if(Pike_sp<Pike_interpreter.evaluator_stack) \    Pike_fatal("Stack error (also simple).\n"); \    ) \    \    Pike_mark_sp=Pike_fp->save_mark_sp; \    \
pike.git/src/interpret.c:1925:   #endif    /* Save various fields from the previous frame.    */    current->save_sp=prev->save_sp;    current->save_mark_sp=prev->save_mark_sp;    current->flags=prev->flags;       /* Unlink the top frame temporarily. */    Pike_interpreter.frame_pointer=prev;    + #if defined(PROFILING) && defined(HAVE_GETHRTIME) +  { +  /* We must update the profiling info of the previous frame +  * to account for that the current frame has gone away. +  */ +  long long total_time = +  gethrtime() - (Pike_interpreter.time_base + current->start_time); +  cpu_time_t child_time = +  Pike_interpreter.accounted_time - current->children_base; +  struct identifier *function = +  current->context.prog->identifiers + current->ident; +  function->total_time += total_time; +  total_time -= child_time; +  function->self_time += total_time; +  Pike_interpreter.accounted_time += total_time; +  } + #endif /* PROFILING && HAVE_GETHRTIME */ +     /* Unlink the frame. */    POP_PIKE_FRAME();       /* Hook our frame again. */    current->next=Pike_interpreter.frame_pointer;    Pike_interpreter.frame_pointer=current;    -  + #if defined(PROFILING) && defined(HAVE_GETHRTIME) +  current->children_base = Pike_interpreter.accounted_time; +  current->start_time = gethrtime() - Pike_interpreter.unlocked_time; + #endif /* PROFILING && HAVE_GETHRTIME */ +    #if 0    /* FIXME: This code is questionable, and the Pike_sp    * adjustment ought to modify the mark stack.    */    {    int freespace;    /* Move svalues down */    freespace=current->locals - current->save_sp;    if(freespace > ((Pike_sp - current->locals)<<2) + 32)    {