Exemple #1
0
void dat_dump(struct index_s *index)
{
    time_info tinfo;
    int time;
    struct datrietree_s* datrie;
    struct stat_info sinfo;

    timestart(&tinfo);
    datrie = loaddatrie_bindict(index->datrie_index_file_name);
    time = timeend(&tinfo);
    printf("Load Datrie Bindict Time: %d\n", time);
    if (!datrie) {
        printf("Load Index Failed: %s\n", index->datrie_index_file_name);
        return;
    }

    printf("Wordimage Size: %lubyte\n", datrie->wordimage->size * sizeof(int));
    printf("Array Size: %lubyte\n", datrie->datrie->size * sizeof(int) * 3);

    stat_count(datrie->datrie, &sinfo);
    printf("Array Total Count: %d Zero Count: %lu Ratio: %.3f%%\n",
           datrie->datrie->size,
           sinfo.zero_count,
           ((double)sinfo.zero_count / (double)datrie->datrie->size)*100);
    printf("Term Total Count: %lu\n",
           sinfo.term_count);
}
Exemple #2
0
void openAll(const char *p)
{
    ScbPath path;
    ScbPageId id;
    ScbPagePtr page;
    strncpy(path.scbname, p, MAX_PATH);
    strncpy(id.id, "10", MAX_PAGEID_LEN);

    // 
    
    timestart();
    ScbDocPtr doc = scb_doc_open(&path);
    ScbPagesPtr pages = scb_doc_get_pages(doc);
    page = scb_pages_get_page(pages, &id);
    timeend();
    

}
Exemple #3
0
void openDirectly(const char *p)
{
    // open directly with p1
    ScbPath path;
    ScbPageId id;
    ScbPagePtr page;
    strncpy(path.scbname, p, MAX_PATH);
    strncpy(id.id, "10", MAX_PAGEID_LEN);
    
    // 
    timestart();
    //page = scb_doc_open_page_directly(&path, &id);
    timeend();

  

    TRACE("done!!!!");
}
Exemple #4
0
int main()
{
  int *a = NULL;
  int *b = NULL;
  time_info ti1;
  time_info ti2;
  int c = 0;
  char* datafile = "./data";
  sort_data* sd = NULL;
  int max;
  int count;
  
  sd = load_sort_data(datafile);
  count = count_sort_data(sd);
  max = max_sort_data(sd);

  printf("sort data count: %d\n", count);
  printf("sort data max: %d\n", max);
  max++;
  
  a = data_sort_data(sd);
  b = (int*)malloc(sizeof(int) * count);
  
  printf("sort data:\n");
  //  outArray(a, count);
  printf("\n\n");

  printf("counting sort ...\n");
  timestart(&ti1);
  Counting_Sort(a, b, count, max);
  c = timeend(&ti1);
  printf("time:%d\n", c);
  //  outArray(b, count);
  printf("\n\n");

  printf("place sort ...\n");
  timestart(&ti2);
  place_sort(a, b, count, max);
  c = timeend(&ti2);

  printf("time:%d\n", c);
  // outArray(b, count);
  //tofile_sort_data(b, count, "place_sort_data");
  printf("\n");

  printf("bit sort ...\n");
  timestart(&ti2);
  bit_sort(a, b, count, max);
  c = timeend(&ti2);

  printf("time:%d\n", c);
  // outArray(b, count);
  //tofile_sort_data(b, count, "bin_sort_data");
  printf("\n");


  printf("quick sort ...\n");
  timestart(&ti2);
  quick_sort(a, 0, count-1);
  c = timeend(&ti2);

  printf("time:%d\n", c);
  // outArray(b, count);
  //tofile_sort_data(a, count, "quick_sort_data");
  printf("\n");

  unload_sort_data(sd);

  // heap sort
  sd = load_sort_data(datafile);
  count = count_sort_data(sd);
  max = max_sort_data(sd);
  max++;
  
  a = data_sort_data(sd);

  printf("heap sort ...\n");
  timestart(&ti2);
  heap_sort(a, count-1);
  c = timeend(&ti2);

  printf("time:%d\n", c);
  //outArray(b, count);
  tofile_sort_data(a, count, "heap_sort_data");
  printf("\n");

  unload_sort_data(sd);

  // max heap sort
  sd = load_sort_data(datafile);
  count = count_sort_data(sd);
  max = max_sort_data(sd);
  max++;
  
  a = data_sort_data(sd);

  printf("max heap sort ...\n");
  timestart(&ti2);
  max_heap_sort(a, count);
  c = timeend(&ti2);
  printf("time:%d\n", c);
  timestart(&ti2);
  push_heap(a, 2345234);
  push_heap(a, 2344);
  push_heap(a, 1232344);
  push_heap(a, 25234);
  push_heap(a, 235234);
  push_heap(a, 23445234);
  push_heap(a, 65434234);
  push_heap(a, 12323434);
  push_heap(a, 25234);
  push_heap(a, 235234);
  c = timeend(&ti2);
  printf("insert 10 to max heap time:%d\n", c);
  //outArray(b, count);
  tofile_sort_data(a, count, "max_heap_sort_data");
  printf("\n");

  unload_sort_data(sd);

  // insert sort
  sd = load_sort_data(datafile);
  count = count_sort_data(sd);
  max = max_sort_data(sd);
  max++;
  
  a = data_sort_data(sd);

  printf("insert sort ...\n");
  timestart(&ti2);
  insert_sort(a, count-1);
  c = timeend(&ti2);

  printf("time:%d\n", c);
  //outArray(b, count);
  tofile_sort_data(a, count, "insert_sort_data");
  printf("\n");

  unload_sort_data(sd);


  return 0;
}