コード例 #1
0
  /** Populate Access_Info table per benchmark spec. */
  void genAccessInfo(Table catalog_tbl) {
    final VoltTable table = CatalogUtil.getVoltTable(catalog_tbl);
    int[] arr = {1, 2, 3, 4};

    int[] ai_types = TM1Util.subArr(arr, 1, 4);
    long total = 0;
    for (long s_id = 0; s_id < this.subscriberSize; s_id++) {
      for (int ai_type : ai_types) {
        Object row[] = new Object[table.getColumnCount()];
        row[0] = s_id;
        row[1] = ai_type;
        row[2] = TM1Util.number(0, 255);
        row[3] = TM1Util.number(0, 255);
        row[4] = TM1Util.astring(3, 3);
        row[5] = TM1Util.astring(5, 5);
        table.addRow(row);
        total++;
      } // FOR
      if (table.getRowCount() >= TM1Constants.BATCH_SIZE) {
        if (d)
          LOG.debug(
              String.format(
                  "%s: %6d / %d",
                  TM1Constants.TABLENAME_ACCESS_INFO, total, ai_types.length * subscriberSize));
        loadVoltTable(TM1Constants.TABLENAME_ACCESS_INFO, table);
        table.clearRowData();
      }
    } // WHILE
    if (table.getRowCount() > 0) {
      if (d)
        LOG.debug(
            String.format(
                "%s: %6d / %d",
                TM1Constants.TABLENAME_ACCESS_INFO, total, ai_types.length * subscriberSize));
      loadVoltTable(TM1Constants.TABLENAME_ACCESS_INFO, table);
      table.clearRowData();
    }
  }
コード例 #2
0
  /** Populate Special_Facility table and CallForwarding table per benchmark spec. */
  void genSpeAndCal(Table catalog_spe, Table catalog_cal) {
    VoltTable speTbl = CatalogUtil.getVoltTable(catalog_spe);
    VoltTable calTbl = CatalogUtil.getVoltTable(catalog_cal);

    long speTotal = 0;
    long calTotal = 0;
    int[] arrSpe = {1, 2, 3, 4};
    int[] arrCal = {0, 8, 6};

    for (long s_id = 0; s_id < this.subscriberSize; s_id++) {
      int[] sf_types = TM1Util.subArr(arrSpe, 1, 4);
      for (int sf_type : sf_types) {
        Object row_spe[] = new Object[speTbl.getColumnCount()];
        row_spe[0] = s_id;
        row_spe[1] = sf_type;
        row_spe[2] = TM1Util.isActive();
        row_spe[3] = TM1Util.number(0, 255);
        row_spe[4] = TM1Util.number(0, 255);
        row_spe[5] = TM1Util.astring(5, 5);
        speTbl.addRow(row_spe);
        speTotal++;

        // now call_forwarding
        int[] start_times = TM1Util.subArr(arrCal, 0, 3);
        for (int start_time : start_times) {
          Object row_cal[] = new Object[calTbl.getColumnCount()];
          row_cal[0] = s_id;
          row_cal[1] = sf_type;
          row_cal[2] = start_time;
          row_cal[3] = start_time + TM1Util.number(1, 8);
          row_cal[4] = TM1Util.nstring(15, 15);
          calTbl.addRow(row_cal);
          calTotal++;
        } // FOR
      } // FOR

      if (calTbl.getRowCount() >= TM1Constants.BATCH_SIZE) {
        if (d) LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_CALL_FORWARDING, calTotal));
        loadVoltTable(TM1Constants.TABLENAME_CALL_FORWARDING, calTbl);
        calTbl.clearRowData();
        assert (calTbl.getRowCount() == 0);
      }
      if (speTbl.getRowCount() >= TM1Constants.BATCH_SIZE) {
        if (d)
          LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_SPECIAL_FACILITY, speTotal));
        loadVoltTable(TM1Constants.TABLENAME_SPECIAL_FACILITY, speTbl);
        speTbl.clearRowData();
        assert (speTbl.getRowCount() == 0);
      }
    } // WHILE
    if (calTbl.getRowCount() > 0) {
      if (d) LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_CALL_FORWARDING, calTotal));
      loadVoltTable(TM1Constants.TABLENAME_CALL_FORWARDING, calTbl);
      calTbl.clearRowData();
      assert (calTbl.getRowCount() == 0);
    }
    if (speTbl.getRowCount() > 0) {
      if (d) LOG.debug(String.format("%s: %d", TM1Constants.TABLENAME_SPECIAL_FACILITY, speTotal));
      loadVoltTable(TM1Constants.TABLENAME_SPECIAL_FACILITY, speTbl);
      speTbl.clearRowData();
      assert (speTbl.getRowCount() == 0);
    }
  }