Exemple #1
0
struct inode*
namei(char *path)
{
  char name[DIRSIZ];
  return namex(path, 0, name);
}
Exemple #2
0
struct inode*
nameiparent(char *path, char *name)
{
  return namex(path, 1, name);
}
Exemple #3
0
struct inode*
sfs_nameiparent(struct inode *node, char *path, char *name)
{
  return namex(node, path, 1, name);
}
Exemple #4
0
struct inode*
nameiparent(char *path, char *name)
{
    K_DEBUG_PRINT(3, "namex(%s, 1, %s)", path, name);
  return namex(path, 1, name);
}
Exemple #5
0
struct inode*
sfs_namei(struct inode *node, char *path)
{
  char name[DIRSIZ];
  return namex(node, path, 0, name);
}
Exemple #6
0
int main()
{
   void            namex();
   int             intwt();
   void            itoa();

   char            cname[10];	/* cache id */
   char            wname[10];	/* workload */
   int             i;

   /* per CPU intruction stream intensity */

   double          Prhit = (RD * HT);
   double          Pwhit = (WR * HT * (1 - WUMD)) + (WR * (1 - HT) * (1 - MD));
   double          Prdop = RD * (1 - HT);
   double          Pwbop = WR * (1 - HT) * MD;
   double          Pwthr = WR;
   double          Pinvl = WR * HT * WUMD;

   double          Nrwht = 0.8075 * MAXCPU;
   double          Nrdop = 0.0850 * MAXCPU;
   double          Nwthr = 0.15 * MAXCPU;

   double          Nwbop = 0.0003 * MAXCPU * 100;
   double          Ninvl = 0.015 * MAXCPU;

   double          Srdop = (20.0);
   double          Swthr = (25.0);
   double          Swbop = (20.0);

   double          Wrwht;
   double          Wrdop;
   double          Wwthr;
   double          Wwbop;
   double          Winvl;

   double          Zrwht = ZX;
   double          Zrdop = ZX;
   double          Zwbop = ZX;
   double          Zinvl = ZX;
   double          Zwthr = ZX;

   double          Xcpu = 0.0;
   double          Pcpu = 0.0;
   double          Ubrd = 0.0;
   double          Ubwr = 0.0;
   double          Ubin = 0.0;
   double          Ucht = 0.0;
   double          Ucrd = 0.0;
   double          Ucwr = 0.0;
   double          Ucin = 0.0;

   char            *model = "ABC Model";

   PDQ_Init(model);

   /* create single bus queueing center */

   PDQ_CreateNode(BUS, CEN, FCFS);

   /* create per CPU cache queueing centers */

   for (i = 0; i < MAXCPU; i++) {
      namex(i, L2C, cname);
      PDQ_CreateNode(cname, CEN, FCFS);
   }

   /* create CPU nodes, workloads, and demands */

   for (i = 0; i < intwt(Nrwht, &Wrwht); i++) {
      namex(i, RWHT, wname);
      PDQ_CreateClosed(wname, TERM, Nrwht, Zrwht);
      namex(i, L2C, cname);
      PDQ_SetDemand(cname, wname, 1.0);
      PDQ_SetDemand(BUS, wname, 0.0);	/* no bus activity */
   }

   for (i = 0; i < intwt(Nrdop, &Wrdop); i++) {
      namex(i, RDOP, wname);
      PDQ_CreateClosed(wname, TERM, Nrdop, Zrdop);
      namex(i, L2C, cname);
      PDQ_SetDemand(cname, wname, gen);	/* generate bus request */
      PDQ_SetDemand(BUS, wname, Srdop);	/* req + async data return */
   }

   if (WBACK) {
      for (i = 0; i < intwt(Nwbop, &Wwbop); i++) {
	 		namex(i, WROP, wname);
	 		PDQ_CreateClosed(wname, TERM, Nwbop, Zwbop);
	 		namex(i, L2C, cname);
	 		PDQ_SetDemand(cname, wname, gen);
	 		PDQ_SetDemand(BUS, wname, Swbop);	/* asych write to memory ? */
      }
   } else {			/* write-thru */
      for (i = 0; i < intwt(Nwthr, &Wwthr); i++) {
	 		namex(i, WROP, wname);
	 		PDQ_CreateClosed(wname, TERM, Nwthr, Zwthr);
	 		namex(i, L2C, cname);
	 		PDQ_SetDemand(cname, wname, gen);
	 		PDQ_SetDemand(BUS, wname, Swthr);
      }
   }

   if (WBACK) {
      for (i = 0; i < intwt(Ninvl, &Winvl); i++) {
	 		namex(i, INVL, wname);
	 		PDQ_CreateClosed(wname, TERM, Ninvl, Zinvl);
	 		namex(i, L2C, cname);
	 		PDQ_SetDemand(cname, wname, gen);	/* gen + intervene */
	 		PDQ_SetDemand(BUS, wname, 1.0);
      }
   }
   
   
   PDQ_SetWUnit("Reqs");
   PDQ_SetTUnit("Cycs");

   PDQ_Solve(APPROX);

   /* bus utilizations */

   for (i = 0; i < intwt(Nrdop, &Wrdop); i++) {
      namex(i, RDOP, wname);
      Ubrd += PDQ_GetUtilization(BUS, wname, TERM);
   }
   Ubrd *= Wrdop;

   if (WBACK) {
      for (i = 0; i < intwt(Nwbop, &Wwbop); i++) {
	 		namex(i, WROP, wname);
	 		Ubwr += PDQ_GetUtilization(BUS, wname, TERM);
      }
      Ubwr *= Wwbop;

      for (i = 0; i < intwt(Ninvl, &Winvl); i++) {
	 		namex(i, INVL, wname);
	 		Ubin += PDQ_GetUtilization(BUS, wname, TERM);
      }
      Ubin *= Winvl;

   } else {			/* write-thru */
      for (i = 0; i < intwt(Nwthr, &Wwthr); i++) {
	 		namex(i, WROP, wname);
	 		Ubwr += PDQ_GetUtilization(BUS, wname, TERM);
      }
      Ubwr *= Wwthr;
   }

   /* cache measures at CPU[0] only */

   i = 0;
   namex(i, L2C, cname);

   namex(i, RWHT, wname);
   Xcpu = PDQ_GetThruput(TERM, wname) * Wrwht;
   Pcpu += Xcpu * Zrwht;
   Ucht = PDQ_GetUtilization(cname, wname, TERM) * Wrwht;

   namex(i, RDOP, wname);
   Xcpu = PDQ_GetThruput(TERM, wname) * Wrdop;
   Pcpu += Xcpu * Zrdop;
   Ucrd = PDQ_GetUtilization(cname, wname, TERM) * Wrdop;

   Pcpu *= 1.88;

   if (WBACK) {
      namex(i, WROP, wname);
      Ucwr = PDQ_GetUtilization(cname, wname, TERM) * Wwbop;
      namex(i, INVL, wname);
      Ucin = PDQ_GetUtilization(cname, wname, TERM) * Winvl;
   } else {			/* write-thru */
      namex(i, WROP, wname);
      Ucwr = PDQ_GetUtilization(cname, wname, TERM) * Wwthr;
   }

   printf("\n**** %s Results ****\n", model);
   printf("PDQ nodes: %d  PDQ streams: %d\n", PDQ_GetNodesCount(), PDQ_GetStreamsCount());
   printf("Memory Mode: %s\n", WBACK ? "WriteBack" : "WriteThru");
   printf("Ncpu:  %2d\n", MAXCPU);
   printf("Nrwht: %5.2f (N:%2d  W:%5.2f)\n",
	  Nrwht, intwt(Nrwht, &Wrwht), Wrwht);
   printf("Nrdop: %5.2f (N:%2d  W:%5.2f)\n",
	  Nrdop, intwt(Nrdop, &Wrdop), Wrdop);

   if (WBACK) {
      printf("Nwbop: %5.2f (N:%2d  W:%5.2f)\n",
	     Nwbop, intwt(Nwbop, &Wwbop), Wwbop);
      printf("Ninvl: %5.2f (N:%2d  W:%5.2f)\n",
	     Ninvl, intwt(Ninvl, &Winvl), Winvl);
   } else {
      printf("Nwthr: %5.2f (N:%2d  W:%5.2f)\n",
	     Nwthr, intwt(Nwthr, &Wwthr), Wwthr);
   }

   printf("\n");
   printf("Hit Ratio:   %5.2f %%\n", HT * 100.0);
   printf("Read Miss:   %5.2f %%\n", RD * (1 - HT) * 100.0);
   printf("WriteMiss:   %5.2f %%\n", WR * (1 - HT) * 100.0);
   printf("Ucpu:        %5.2f %%\n", Pcpu * 100.0 / MAXCPU);
   printf("Pcpu:        %5.2f\n", Pcpu);
   printf("\n");
   printf("Ubus[reads]: %5.2f %%\n", Ubrd * 100.0);
   printf("Ubus[write]: %5.2f %%\n", Ubwr * 100.0);
   printf("Ubus[inval]: %5.2f %%\n", Ubin * 100.0);
   printf("Ubus[total]: %5.2f %%\n", (Ubrd + Ubwr + Ubin) * 100.0);
   printf("\n");
   printf("Uca%d[hits]:  %5.2f %%\n", i, Ucht * 100.0);
   printf("Uca%d[reads]: %5.2f %%\n", i, Ucrd * 100.0);
   printf("Uca%d[write]: %5.2f %%\n", i, Ucwr * 100.0);
   printf("Uca%d[inval]: %5.2f %%\n", i, Ucin * 100.0);
   printf("Uca%d[total]: %5.2f %%\n", i, (Ucht + Ucrd + Ucwr + Ucin) * 100.0);

}
Exemple #7
0
struct inode*
readnamei(char *path, char *name)
{
  return namex(path, 0, name, 0, 0,0);
}
Exemple #8
0
//part 1 - signature change, and de-referencing symbolic links to the correct inode
struct inode*
namex(char *path, int nameiparent, char *name, 
      struct inode *prev, int loopCount,int noDeRef)
{
  struct inode *ip, *next;
  char buf[512];

  // part 1 - prevent loop in symbolic links
  if(loopCount > 16)
    return 0;

  if(*path == '/') {
    ip = iget(ROOTDEV, ROOTINO);
  } else if(prev) {
    ip = idup(prev);
  } else {
    ip = idup(proc->cwd);
  }

  while( (path = skipelem(path, name)) != 0 ) {
    ilock(ip);
    if(ip->type != T_DIR){
      iunlockput(ip);
      return 0;
    }
    if(nameiparent && *path == '\0'){
      // Stop one level early.
      iunlock(ip);
      return ip;
    }
    if((next = dirlookup(ip, name, 0)) == 0){
      iunlockput(ip);
      return 0;
    }

    if(noDeRef) {
        iunlockput(ip);
    } else {
        iunlock(ip);

        //part 1
        ilock(next);

        if(next->type == T_SYMLINK) {
            if(readi(next, buf, 0, sizeof(buf)) != next->size) {
                iunlockput(ip);
                return 0;
            }
            buf[next->size] = 0;
            iunlock(next);
            next = namex(buf, 0, name, ip, loopCount++,0);
        } else {
            iunlock(next);
        }
        // End part 1

        iput(ip);
    }
    ip = next;
  }
  if(nameiparent) {
    iput(ip);
    return 0;
  }
  return ip;
}
Exemple #9
0
struct inode* nameiIgnoreMounts(char* path)
{
    char name[DIRSIZ];
    return namex(path, 0, 1, name);
}