Branch: Tag:

2016-02-11

2016-02-11 19:29:10 by Martin Nilsson <nilsson@fastmail.com>

fprintf to WERR conversion.

578: Inside #if defined(USE_CLOCK_FOR_SLICES)
   prev_tsc = 0;   #endif   #ifdef PROFILE_CHECK_THREADS -  fprintf (stderr, "[%d:%f] pike_init_thread_state: tsc reset\n", +  WERR("[%d:%f] pike_init_thread_state: tsc reset\n",    getpid(), get_real_time() * (1.0 / CPU_TIME_TICKS));   #endif   #endif
1318: Inside #if defined(PIKE_DEBUG)
   struct thread_state *s;    THREAD_T self = th_self();    -  fprintf(stderr,"--Listing all threads--\n"); -  fprintf (stderr, "Current thread: %"PRINTSIZET"x\n", (size_t) self); -  fprintf(stderr,"Current interpreter thread state: %p%s\n", +  WERR("--Listing all threads--\n"); +  WERR("Current thread: %"PRINTSIZET"x\n", (size_t) self); +  WERR("Current interpreter thread state: %p%s\n",    Pike_interpreter.thread_state,    Pike_interpreter.thread_state == (struct thread_state *) (ptrdiff_t) -1 ?    " (swapped)" : ""); -  fprintf(stderr,"Current thread state according to thread_state_for_id(): %p\n", +  WERR("Current thread state according to thread_state_for_id(): %p\n",    thread_state_for_id (self)); -  fprintf(stderr,"Current thread obj: %p\n", +  WERR("Current thread obj: %p\n",    (Pike_interpreter.thread_state &&    Pike_interpreter.thread_state != (struct thread_state *) (ptrdiff_t) -1) ?    Pike_interpreter.thread_state->thread_obj : NULL); -  fprintf(stderr,"Current thread hash: %d\n",thread_table_hash(&self)); -  fprintf(stderr,"Current stack pointer: %p\n",&self); +  WERR("Current thread hash: %d\n",thread_table_hash(&self)); +  WERR("Current stack pointer: %p\n",&self);    for(x=0; x<THREAD_TABLE_SIZE; x++)    {    for(s=thread_table_chains[x]; s; s=s->hashlink) {    struct object *o = THREADSTATE2OBJ(s); -  fprintf(stderr,"ThTab[%d]: state=%p, obj=%p, " +  WERR("ThTab[%d]: state=%p, obj=%p, "    "swapped=%d, sp=%p (%+"PRINTPTRDIFFT"d), fp=%p, stackbase=%p, "    "id=%"PRINTSIZET"x\n",    x, s, o, s->swapped,
1347: Inside #if defined(PIKE_DEBUG)
   (size_t) s->id);    }    } -  fprintf(stderr,"-----------------------\n"); +  WERR("-----------------------\n");   }   #endif   
1399: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES)
   * the only effect is that we always fall back to    * clock(3). */   #ifdef PROFILE_CHECK_THREADS -  fprintf (stderr, "[%d:%f] TSC backward jump detected " +  WERR("[%d:%f] TSC backward jump detected "    "(now: %"PRINTINT64"d, prev: %"PRINTINT64"d, "    "target_int: %"PRINTINT64"d) - resetting\n",    getpid(), get_real_time() * (1.0 / CPU_TIME_TICKS),
1458: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES)
   /* The most likely cause for this is high variance in the    * interval lengths due to low clock(3) resolution. */   #ifdef PROFILE_CHECK_THREADS -  fprintf (stderr, "[%d:%f] Capping large TSC interval increase " +  WERR("[%d:%f] Capping large TSC interval increase "    "(from %"PRINTINT64"d to %"PRINTINT64"d)\n",    getpid(), get_real_time() * (1.0 / CPU_TIME_TICKS),    target_int, new_target_int);
1490: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES)
   }    else {   #ifdef PROFILE_CHECK_THREADS -  fprintf (stderr, "[%d:%f] Warning: Encountered zero prev_tsc " +  WERR("[%d:%f] Warning: Encountered zero prev_tsc "    "(thread_start_clock: %"PRINTINT64"d, "    "clock_now: %"PRINTINT64"d)\n",    getpid(), get_real_time() * (1.0 / CPU_TIME_TICKS),
1618: Inside #if defined(PROFILE_CHECK_THREADS)
      ACCURATE_GETTIMEOFDAY (&now);    if (now.tv_sec > last_time) { -  fprintf (stderr, "[%d:%f] check_threads: %lu calls, " +  WERR("[%d:%f] check_threads: %lu calls, "    "%lu clocks, %lu no advs, %lu yields"    ", tps %g:%.1e\n",    getpid(), get_real_time() * (1.0 / CPU_TIME_TICKS),
1707: Inside #if defined(HAVE_BROKEN_LINUX_THREAD_EUID), #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) and #if defined(PIKE_DEBUG)
   int current = prctl(PR_GET_DUMPABLE);   #ifdef PIKE_DEBUG    if (current == -1) -  fprintf (stderr, "%s:%d: Unexpected error from prctl(2). errno=%d\n", +  WERR("%s:%d: Unexpected error from prctl(2). errno=%d\n",    __FILE__, __LINE__, errno);   #endif   #endif   #ifdef HAVE_BROKEN_LINUX_THREAD_EUID    if( setegid(arg.egid) != 0 || seteuid(arg.euid) != 0 )    { -  fprintf (stderr, "%s:%d: Unexpected error from setegid(2). errno=%d\n", +  WERR("%s:%d: Unexpected error from setegid(2). errno=%d\n",    __FILE__, __LINE__, errno);    }   #endif
3148: Inside #if defined(HAVE_BROKEN_LINUX_THREAD_EUID) and #if defined(HAVE_BROKEN_LINUX_THREAD_EUID)
  #ifdef HAVE_BROKEN_LINUX_THREAD_EUID    if( setegid(arg.egid) != 0 || seteuid(arg.euid) != 0 )    { -  fprintf (stderr, "%s:%d: Unexpected error from setegid(2). errno=%d\n", +  WERR("%s:%d: Unexpected error from setegid(2). errno=%d\n",    __FILE__, __LINE__, errno);    }   #endif
3161:       do    { - /* if(farmers == me) Pike_fatal("Ouch!\n"); */ - /* fprintf(stderr, "farm_begin %p\n",me ); */ +     me->harvest( me->field ); - /* fprintf(stderr, "farm_end %p\n", me); */ +        me->harvest = 0;    mt_lock( &rosie );
3178:    }    me->neighbour = farmers;    farmers = me; - /* fprintf(stderr, "farm_wait %p\n", me); */ +     while(!me->harvest) co_wait( &me->harvest_moon, &rosie );    --_num_idle_farmers;    mt_unlock( &rosie ); - /* fprintf(stderr, "farm_endwait %p\n", me); */ +     } while(1);    UNREACHABLE(return 0);   }
3474: Inside #if defined(DO_PIKE_CLEANUP) and #if 0
     #if 0    if (num_kills) { -  fprintf (stderr, "Killed %d thread(s) in exit cleanup", +  WERR("Killed %d thread(s) in exit cleanup",    num_kills - num_pending_interrupts);    if (num_pending_interrupts) -  fprintf (stderr, ", %d more haven't responded", num_pending_interrupts); +  WERR(", %d more haven't responded", num_pending_interrupts);    fputs (".\n", stderr);    }   #endif