~mingqiangzhuang/libmemcached/icc-memslap

« back to all changes in this revision

Viewing changes to clients/ms_setting.c

  • Committer: Brian Aker
  • Date: 2010-01-19 04:59:05 UTC
  • mfrom: (753.1.1 libmemcached)
  • Revision ID: brian@gaz-20100119045905-e6vjp6lcp0b7bymi
Merge memslap

Show diffs side-by-side

added added

removed removed

Lines of Context:
342
342
  FILE *f;
343
343
  size_t start_len, end_len;
344
344
  double proportion;
345
 
  size_t frequence;
346
345
  char *line= NULL;
347
346
  size_t  read_len;
348
347
  ssize_t nread;
435
434
 
436
435
        if (nread != EOF)
437
436
        {
438
 
          if (sscanf(line, "%zu %zu %lf %zu", &start_len, &end_len,
439
 
                     &proportion, &frequence) != 3)
 
437
          if (sscanf(line, "%zu %zu %lf", &start_len, &end_len,
 
438
                     &proportion) != 3)
440
439
          {
441
440
            conf_type= ms_get_conf_type(line);
442
441
            break;
479
478
 
480
479
        if (nread != EOF)
481
480
        {
482
 
          if (sscanf(line, "%d %lf\n", &cmd_type, &proportion) != 2)
 
481
          if (sscanf(line, "%d %lf", &cmd_type, &proportion) != 2)
483
482
          {
484
483
            conf_type= ms_get_conf_type(line);
485
484
            break;
486
485
          }
 
486
          if (cmd_type >= CMD_NULL)
 
487
          {
 
488
            continue;
 
489
          }
487
490
          ms_setting.cmd_distr[ms_setting.cmd_used_count].cmd_type=
488
491
            cmd_type;
489
492
          ms_setting.cmd_distr[ms_setting.cmd_used_count].cmd_prop=
920
923
static void ms_setting_slapmode_init_post()
921
924
{
922
925
  ms_setting.total_key_rng_cnt= KEY_RANGE_COUNT_INIT;
923
 
  ms_setting.key_distr= 
 
926
  ms_setting.key_distr=
924
927
    (ms_key_distr_t *)malloc((size_t)ms_setting.total_key_rng_cnt * sizeof(ms_key_distr_t));
925
928
 
926
929
  if (ms_setting.key_distr == NULL)
931
934
 
932
935
  ms_setting.total_val_rng_cnt= VALUE_RANGE_COUNT_INIT;
933
936
 
934
 
  ms_setting.value_distr= 
 
937
  ms_setting.value_distr=
935
938
    (ms_value_distr_t *)malloc((size_t)ms_setting.total_val_rng_cnt * sizeof( ms_value_distr_t));
936
939
 
937
940
  if (ms_setting.value_distr == NULL)
980
983
    exit(1);
981
984
  }
982
985
 
983
 
  if ((ms_setting.udp
984
 
       || ms_setting.facebook_test) && ms_setting.binary_prot)
985
 
  {
986
 
    fprintf(stderr, "Binary protocol doesn't support UDP now.\n");
987
 
    exit(1);
988
 
  }
989
 
 
990
986
  if ((ms_setting.rep_write_srv > 0) && (ms_setting.srv_cnt < 2))
991
987
  {
992
988
    fprintf(stderr, "Please specify 2 servers at least for replication\n");
1007
1003
    exit(1);
1008
1004
  }
1009
1005
 
1010
 
  if ((ms_setting.rep_write_srv > 0) && (ms_setting.sock_per_conn > 1))
1011
 
  {
1012
 
    fprintf(stderr, "Replication doesn't support multi-socks "
1013
 
                    "in one connection structure.\n");
1014
 
    exit(1);
1015
 
  }
1016
 
 
1017
1006
  if (ms_setting.facebook_test && (ms_setting.rep_write_srv > 0))
1018
1007
  {
1019
1008
    fprintf(stderr, "facebook test couldn't work with replication.\n");
1020
1009
    exit(1);
1021
1010
  }
1022
1011
 
1023
 
  if (ms_setting.reconnect && (ms_setting.sock_per_conn > 1))
1024
 
  {
1025
 
    fprintf(stderr, "Reconnection doesn't support multi-socks "
1026
 
                    "in one connection structure.\n");
1027
 
    exit(1);
1028
 
  }
1029
 
 
1030
1012
  ms_build_distr();
1031
1013
 
1032
1014
  /* initialize global character block */