示例#1
0
/**
 * Get the current load.
 *
 * @param load load handle
 * @return zero for below-average load, otherwise
 *         number of std. devs we are above average;
 *         100 if the latest updates were so large
 *         that we could not do proper calculations
 */
double
GNUNET_LOAD_get_load (struct GNUNET_LOAD_Value *load)
{
  internal_update (load);
  calculate_load (load);
  return load->load;
}
示例#2
0
/**
 * Change the value by which the load automatically declines.
 *
 * @param load load to update
 * @param autodecline frequency of load decline
 */
void
GNUNET_LOAD_value_set_decline (struct GNUNET_LOAD_Value *load,
                               struct GNUNET_TIME_Relative autodecline)
{
  internal_update (load);
  load->autodecline = autodecline;
}
示例#3
0
文件: mcs96.cpp 项目: motoschifo/mame
void mcs96_device::execute_run()
{
    internal_update(total_cycles());

    //  if(inst_substate)
    //      do_exec_partial();

    while(icount > 0) {
        while(icount > bcount) {
            int picount = inst_state >= 0x200 ? -1 : icount;
            do_exec_full();
            if(icount == picount) {
                fatalerror("Unhandled %x (%04x)\n", inst_state, PPC);
            }
        }
        while(bcount && icount <= bcount)
            internal_update(total_cycles() + icount - bcount);
        //      if(inst_substate)
        //          do_exec_partial();
    }
}
示例#4
0
/**
 * Get the average value given to update so far.
 *
 * @param load load handle
 * @return zero if update was never called
 */
double
GNUNET_LOAD_get_average (struct GNUNET_LOAD_Value *load)
{
  double n;
  double sum_val_i;

  internal_update (load);
  if (load->cummulative_request_count == 0)
    return 0.0;
  n = ((double) load->cummulative_request_count);
  sum_val_i = (double) load->cummulative_delay;
  return sum_val_i / n;
}
示例#5
0
void mcs96_device::execute_run()
{
    UINT64 start_cycles = machine().time().as_ticks(clock());
    end_cycles = start_cycles + icount;

    internal_update(start_cycles);

    if(/*inst_substate*/ 0)
        do_exec_partial();

    while(icount > 0) {
        while(icount > bcount) {
            int picount = inst_state >= 0x200 ? -1 : icount;
            do_exec_full();
            if(icount == picount) {
                fprintf(stderr, "Unhandled %x (%04x)\n", inst_state, PPC);
                exit(0);
            }
        }
        while(bcount && icount <= bcount)
            internal_update(end_cycles - bcount);
    }
    end_cycles = 0;
}
示例#6
0
文件: i8x9x.c 项目: opicron/mame
void i8x9x_device::commit_hso_cam()
{
	for(int i=0; i<8; i++)
		if(!hso_info[i].active) {
			if(hso_command != 0x18 && hso_command != 0x19)
				logerror("%s: hso cam %02x %04x in slot %d (%04x)\n", tag(), hso_command, hso_time, i, PPC);
			hso_info[i].active = true;
			hso_info[i].command = hso_command;
			hso_info[i].time = hso_time;
			internal_update(get_cycle());
			return;
		}
	hso_cam_hold.active = true;
	hso_cam_hold.command = hso_command;
	hso_cam_hold.time = hso_time;
}
示例#7
0
/**
 * Update the current load.
 *
 * @param load to update
 * @param data latest measurement value (for example, delay)
 */
void
GNUNET_LOAD_update (struct GNUNET_LOAD_Value *load, uint64_t data)
{
  uint32_t dv;

  internal_update (load);
  load->last_update = GNUNET_TIME_absolute_get ();
  if (data > 64 * 1024)
  {
    /* very large */
    load->load = 100.0;
    return;
  }
  dv = (uint32_t) data;
  load->cummulative_delay += dv;
  load->cummulative_squared_delay += dv * dv;
  load->cummulative_request_count++;
  load->runavg_delay = ((load->runavg_delay * 7.0) + dv) / 8.0;
}
示例#8
0
文件: bit.cpp 项目: pibomb/chipmunk
void chipmunk::RURQ_BIT::update(int idx1, int idx2, int val) {
	internal_update(0, idx1, val);
	internal_update(0, idx2 + 1, -val);
	internal_update(1, idx1, val * (idx1 - 1));
	internal_update(1, idx2 + 1, -val * idx2);
}
示例#9
0
文件: i8x9x.c 项目: opicron/mame
void i8x9x_device::ad_start(UINT64 current_time)
{
	ad_result = (io->read_word(2*((ad_command & 7) + A0)) << 6) | 8 | (ad_command & 7);
	ad_done = current_time + 88;
	internal_update(current_time);
}
示例#10
0
            size_t find ( _fx fx, const Ty * pY, size_t beg, size_t end
                          , std::vector< adportable::waveform_peakfinder::peakinfo >& results  ) const {
            
                if ( pY == 0 || ( end - beg ) < 7 )
                    return 0;

                int iw = 5;
                int m = iw;
                int NH = m / 2;
                double peakw = fpeakw_( beg, iw );
                double slope = double( rms_ ) / double( iw * 16 );
                internal_update( beg, peakw, iw, m, NH, slope );
            
                SGFilter diff( m, SGFilter::Derivative1, SGFilter::Cubic );

                slope_state<counter> state( iw / 2 );
    
                size_t base_pos = 0, base_c = 0;

                for ( size_t x = beg + NH; x < end - NH; ++x ) {

                    double d1 = diff( &pY[x] );

                    bool reduce = false;
                    if ( d1 >= slope ) {
                        base_c = 0;
                        reduce = state.process_slope( counter( x, Up ) );
                    } else if ( d1 <= (-slope ) ) {
                        base_c = 0;
                        reduce = state.process_slope( counter( x, Down ) );
                    } else {
                        if ( state.stack_.size() < 2 ) {
                            ++base_c;
                            base_pos = x;
                        }
                    }

                    if ( reduce ) {
                        std::pair< counter, counter > peak;
                        while ( state.reduce( peak ) ) {
                            if ( fx( peak.second.tpos_ ) - fx( peak.first.bpos_ ) >= peakw ) {
                                results.push_back( peakinfo( peak.first.bpos_, peak.second.tpos_, 0 ) );
                            }
                        }
                        internal_update( x, peakw, iw, m, NH, slope );
                    } 
                }

                if ( ! state.stack_.empty() ) {

                    if ( state.stack_.top().type() == Down )
                        state.stack_.push( counter( end - 1, None ) ); // dummy

                    std::pair< counter, counter > peak;

                    while ( state.reduce( peak ) ) {
                        if ( fx( peak.second.tpos_ ) - fx( peak.first.bpos_ ) >= peakw ) {
                            results.push_back( peakinfo( peak.first.bpos_, peak.second.tpos_, 0 ) );
                        }
                    }
                }
            
                return results.size();
            }
示例#11
0
 inline void update(ExprNode<matrix, T_element>& previous, ExprNode<matrix, T_element>& next) const
 {
   internal_update(previous, next);
 }