示例#1
0
    int BaseStrategy::check(const ServerCollect* server_collect) const
    {
      if (!server_collect->is_alive())
      {
        TBSYS_LOG(DEBUG, "dataserver(%s) is dead, can't join ",
            CNetUtil::addrToString(server_collect->get_ds()->id_).c_str());
        return 0;
      }
      const DataServerStatInfo* ds_stat_info = server_collect->get_ds();

      return check_average(ds_stat_info->current_load_, global_info_.total_load_, ds_stat_info->use_capacity_,
          global_info_.total_capacity_, global_info_.alive_server_count_);
    }
示例#2
0
文件: driver.c 项目: kywe665/ECEn-324
/* 
 * check_smooth - Make sure the smooth function actually works.  The
 * orig array should not have been tampered with!  
 */
static int check_smooth(int dim) {
    int err = 0;
    int i, j;
    int badi = 0;
    int badj = 0;
    pixel right, wrong;

    /* +++++ egm 10/26/2005
     * Added initialization code to quiet warnings
     * from gcc 4.0.2 compiler.
     * -----
     */

    right.red = right.green = right.blue = 0;
    wrong.red = wrong.green = wrong.blue = 0;

    /* return 1 if original image has been changed */
    if (check_orig(dim)) 
	return 1; 

    for (i = 0; i < dim; i++) {
	for (j = 0; j < dim; j++) {
	    pixel smoothed = check_average(dim, i, j, orig);
	    if (compare_pixels(result[RIDX(i,j,dim)], smoothed)) {
		err++;
		badi = i;
		badj = j;
		wrong = result[RIDX(i,j,dim)];
		right = smoothed;
	    }
	}
    }

    if (err) {
	printf("\n");
	printf("ERROR: Dimension=%d, %d errors\n", dim, err);    
	printf("E.g., \n");
	printf("You have dst[%d][%d].{red,green,blue} = {%d,%d,%d}\n",
	       badi, badj, wrong.red, wrong.green, wrong.blue);
	printf("It should be dst[%d][%d].{red,green,blue} = {%d,%d,%d}\n",
	       badi, badj, right.red, right.green, right.blue);
    }

    return err;
}