Пример #1
0
/**
 * Benchmark macro for transportation of fake data blocks through an HLT
 * hierarchy.
 *
 * Usage:
 * <pre>
 *   aliroot -b -q bench-hlt-hierarchy.C | tee bench-hlt-hierarchy.log
 * </pre>
 * Options:
 * <pre>
 *   aliroot -b -q bench-hlt-hierarchy.C'(2, "root raw")'
 * </pre>
 * First argument allows to specifiy the number of events, the second one
 * is a string defining the output, "root" for a statistics in a root file
 * and "raw" for just the raw data block. Can be combined. Default is "root".
 *
 * @ingroup alihlt_benchmark
 * @author [email protected]
 */
void bench_hlt_hierarchy(int events=100, const char* option="root")
{
  TString options=option;
  AliHLTSystem gHLT(0x7c);
  gHLT.LoadComponentLibraries("libAliHLTUtil.so");

  ///////////////////////////////////////////////////////////////////////////////////////////////////
  //
  // define the analysis chain to be run
  //
  const int iNofLevel0=6;
  const int iNofLevel1=18;
  const int iNofLevel2=2;
  TString level3Input;
  TString arg, component;
  for (int level2=0; level2<iNofLevel2; level2++) {
    TString level2Input;
    for (int level1=0; level1<iNofLevel1; level1++) {
      TString level1Input;
      for (int level0=0; level0<iNofLevel0; level0++) {
	// level0 publisher component
	arg.Form("-datatype DUMMYDAT FAKE -size 10000 -range 1000 -modulo 10 -decrement 1000");
	component.Form("L0_%d_%02d_%d", level2, level1, level0);
	AliHLTConfiguration l0conf(component.Data(), "DataGenerator", NULL , arg.Data());

	if (level1Input.Length()>0) level1Input+=" ";
	level1Input+=component;
      }

      // level 1 components
      arg.Form("-datatype DUMMYDAT FAKE -multiplier 0.2");
      component.Form("L1_%d_%02d", level2, level1);
      AliHLTConfiguration l1conf(component.Data(), "DataGenerator", level1Input.Data(), arg.Data());
      if (level2Input.Length()>0) level2Input+=" ";
      level2Input+=component;
    }

    // level 2 components
    arg.Form("-datatype DUMMYDAT FAKE -multiplier 1.0");
    component.Form("L2_%d", level2);
    AliHLTConfiguration l2conf(component.Data(),"DataGenerator",level2Input.Data(), arg.Data());
    if (level3Input.Length()>0) level3Input+=" ";
    level3Input+=component;
  }

  arg.Form("-datatype DUMMYDAT FAKE -multiplier 1.0");
  AliHLTConfiguration l3conf("L3","DataGenerator",level3Input.Data(),arg.Data());
  AliHLTConfiguration statroot("statroot", "StatisticsCollector"   , "L3", "-file HLT.statistics.root -publish 0");
  AliHLTConfiguration statraw("statraw", "FileWriter"   , "L3", "-datafile HLT.statistics.raw -concatenate-events -concatenate-blocks -datatype COMPSTAT PRIV");

  if (options.Contains("root"))
      gHLT.BuildTaskList("statroot");
  if (options.Contains("raw"))
      gHLT.BuildTaskList("statraw");
  gHLT.Run(events);
}
Пример #2
0
int stat(const char *path, FAR struct stat *buf)
{
  FAR struct inode *inode;
  const char       *relpath = NULL;
  int               ret     = OK;

  /* Sanity checks */

  if (!path || !buf)
    {
      ret = EFAULT;
      goto errout;
    }

  if (!path[0])
    {
      ret = ENOENT;
      goto errout;
    }

  /* Check for the fake root directory (which has no inode) */

  if (strcmp(path, "/") == 0)
    {
      return statroot(buf);
    }

  /* Get an inode for this file */

  inode = inode_find(path, &relpath);
  if (!inode)
    {
      /* This name does not refer to a psudeo-inode and there is no
       * mountpoint that includes in this path.
       */

      ret = ENOENT;
      goto errout;
    }

  /* The way we handle the stat depends on the type of inode that we
   * are dealing with.
   */

#ifndef CONFIG_DISABLE_MOUNTPOINT
  if (INODE_IS_MOUNTPT(inode))
    {
      /* The node is a file system mointpoint. Verify that the mountpoint
       * supports the stat() method
       */

      if (inode->u.i_mops && inode->u.i_mops->stat)
        {
          /* Perform the stat() operation */

          ret = inode->u.i_mops->stat(inode, relpath, buf);
        }
    }
  else
#endif
    {
      /* The node is part of the root pseudo file system */

      ret = statpseudo(inode, buf);
    }

  /* Check if the stat operation was successful */

  if (ret < 0)
    {
      ret = -ret;
      goto errout_with_inode;
    }

  /* Successfully stat'ed the file */

  inode_release(inode);
  return OK;

/* Failure conditions always set the errno appropriately */

errout_with_inode:
  inode_release(inode);
errout:
  set_errno(ret);
  return ERROR;
}