Ejemplo n.º 1
0
void
flushDNLC()
/* Flush directory-name lookup cache -- the hierarchy used has already
   been created at the beginning of the benchmark */
{
  int i;
  struct stat buf;

#ifdef DEBUG2
  printf("flushDNLC\n");
#endif

  /* stat the dirs sequentially */
  for (i = 0; i < numFilesDNLC; i++)
    if (stat(fnameDNLC[i], &buf) == -1) {
      perror("flushDNLC, stat");
      exit(1);
    }

  /* stat the dirs in random order */
  createPerm(&addrArrayDNLC, numFilesDNLC, 1, numFilesDNLC);
  for (i = 0; i < numFilesDNLC; i++)
    if (stat(fnameDNLC[addrArrayDNLC[i]], &buf) == -1) {
      perror("flushDNLC, stat");
      exit(1);
    }
}
Ejemplo n.º 2
0
void
flushInode()
/* Flush inode cache -- the hierarchy used has already been created 
   at the beginning of the benchmark */
{
  int i;
  struct stat buf;
 
#ifdef DEBUG2
  printf("flushInode\n");
#endif

  /* stat the files sequentially */
  for (i = 0; i < numFilesFlush; i++)
    if (stat(fnameFlush[i], &buf) < 0) {
      perror("flushInode, stat");
      exit(1);
    }

  /* stat the files in random order */
  createPerm(&addrArrayFlush, numFilesFlush, 1, numFilesFlush);
  for (i = 0; i < numFilesFlush; i++)
    if (stat(fnameFlush[addrArrayFlush[i]], &buf) < 0) {
      perror("flushInode, stat2");
      exit(1);
    }
}
Ejemplo n.º 3
0
revtrie createRevTrie(uint *string, uint *id, lztrie trie, uint *emptybmap, uint n)
 { 
    revtrie T;
    uint i;
    T        = malloc(sizeof(struct srevtrie));
    T->data  = string;
    T->pdata = createParentheses(string,2*n,false,true);
    T->B     = createBitmap(emptybmap, n,false);
    T->n     = n;
    T->nbits = bits(trie->n-1);
    T->rids  = createPerm(id, trie->n, PARAMETER_T_RIDS);
    T->trie  = trie;
    return T;
 }
Ejemplo n.º 4
0
Archivo: lztrie.c Proyecto: peper/pizza
lztrie createLZTrie(uint *string, byte *letters, uint *id, uint n)
 { 
    lztrie T;
    uint i;
    T          = malloc(sizeof(struct slztrie));
    T->data    = string;
    T->pdata   = createParentheses(string,2*n,true,true);
    T->n       = n;
    T->letters = letters;
    // creates the ids permutation
    T->ids     = createPerm(id, n, PARAMETER_T_IDS);
    // boost first access
    T->boost   = malloc(256*sizeof(trieNode));
    for (i=0;i<256;i++) T->boost[i] = NULLT;
    i = 1; // shortcut for first child of root
    while (i != 2*n-1) { // shortcut for its closing parenthesis
       T->boost[T->letters[i-rank(T->pdata->bdata,i)]] = i;
       // shortcut for leftrankLZTrie
       i = findclose(T->pdata,i)+1;
    }
    return T;
 }
Ejemplo n.º 5
0
static_permutation_mrrr::static_permutation_mrrr(uint * elems, uint nelems, uint t, static_bitsequence_builder * bmb) {
  permutation = createPerm(elems, nelems, t, bmb);
}
Ejemplo n.º 6
0
	PermutationMRRR::PermutationMRRR(uint * elems, uint nelems, uint t, BitSequenceBuilder * bmb) {
		permutation = createPerm(elems, nelems, t, bmb);
	}
Ejemplo n.º 7
0
void
getInodeAccessTimes(struct sub_data *inodeAccess, char **dname, char **fname,
		    int numdirs, int numFiles)
{
  int *perm;
  int fd, i, j;
  int startTime, endTime;
  struct alfs_stat buf;

#ifdef DEBUG
  printf("InodeAccessTime\n");
#endif

  perm = (int *) myMalloc (sizeof(int) * numFiles);

  /* create the files */
  for (i = 0; i < numFiles; i++) {
    if ((fd = open(fname[i], O_RDWR | O_CREAT | O_TRUNC, S_IRWXU)) == -1) {
      perror("inodeAccess, create");
      exit(1);
    }
    close(fd);
  }
    
  for (j = 0; j < reps; j++) {
    /* create permuation */
    createPerm(&perm, numFiles, 1, numFiles);

    /* flush buffers */
    flushAll();
    
    /* stat the path to get the path into the cache */
    for (i = 0; i < numdirs; i++)
      if (stat(dname[i], &buf) < 0) {
	perror("inodeAccess, stat path");
	exit(1);
      }

    /* stat in creation order */
    gettimeofday(&startTime, (struct timezone *) NULL);
    for (i = 0; i < numFiles; i++) {
      if (stat(fname[i], &buf) < 0) {
	perror("inodeAccess, stat seq");
	exit(1);
      }
    }
    gettimeofday(&endTime, (struct timezone *) NULL);
    inodeAccess->time1[j] = diffTime(startTime, endTime);
#ifdef DEBUG
    printf("SEQ: numFiles: %d, time: %f\n", numFiles, inodeAccess->time1[j]);
#endif

    /* flush buffers */
    flushAll();

    /* stat the path to get the path into the cache */
    for (i = 0; i < numdirs; i++)
      if (stat(dname[i], &buf) < 0) {
	perror("inodeAccess, stat path 2");
	exit(1);
      }

    /* stat in random order */
    gettimeofday(&startTime, (struct timezone *) NULL);
    for (i = 0; i < numFiles; i++) {
      if (stat(fname[perm[i]], &buf) < 0) {
	perror("inodeAccess, stat rand");
	exit(1);
      }
    }
    gettimeofday(&endTime, (struct timezone *) NULL);
    inodeAccess->time2[j] = diffTime(startTime, endTime);
#ifdef DEBUG
    printf("RAND: numFiles: %d, time: %f\n", numFiles, inodeAccess->time2[j]);
#endif
  }

  /* clean-up */
  for (i = 0; i < numFiles; i++)
    if (unlink(fname[i]) < 0) {
      perror("inodeAccessTime, unlink");
      exit(1);
    }
  free(perm);
}