Exemple #1
0
static void cg_post_clo_init(void)
{
   HChar* qual = NULL;
   cache_t I1c, D1c, L2c; 
   Int filename_szB;

   /* Get working directory */
   tl_assert( VG_(getcwd)(base_dir, VKI_PATH_MAX) );

   /* Do we have a --log-file-qualifier= to consider? */
   if (VG_(clo_log_file_qualifier)) {
      qual = VG_(getenv)(VG_(clo_log_file_qualifier));
   }

   /* Block is big enough for 
        dir name ++ cachegrind_out_file_basename
                 ++ ".<pid>" 
                 ++ the log file qualifier, if in use */
   filename_szB 
      = VG_(strlen)(base_dir) 
        + 1  /* "/" */
        + VG_(strlen)(cachegrind_out_file_basename)
        + 11  /* "." <pid>, assuming sizeof(pid) <= 4 */
        + (qual  ? (10 + VG_(strlen)(qual))  : 0)
        + 1; /* to guarantee checkable zero at the end */

   tl_assert(filename_szB > 0);
   cachegrind_out_file 
      = VG_(calloc)( sizeof(Char), filename_szB );

   if (qual) {
      VG_(sprintf)(cachegrind_out_file, "%s/%s.%d.lfq.%s",
                   base_dir, cachegrind_out_file_basename, 
                   VG_(getpid)(), qual);
   } else {
      VG_(sprintf)(cachegrind_out_file, "%s/%s.%d",
                   base_dir, cachegrind_out_file_basename, 
                   VG_(getpid)());
   }

   tl_assert( cachegrind_out_file[filename_szB-1] == 0 );

   CC_table = VG_(OSet_Create)(offsetof(LineCC, loc),
                               cmp_CodeLoc_LineCC,
                               VG_(malloc), VG_(free));
   instrInfoTable = VG_(OSet_Create)(/*keyOff*/0,
                                     NULL,
                                     VG_(malloc), VG_(free));
   stringTable    = VG_(OSet_Create)(/*keyOff*/0,
                                     stringCmp,
                                     VG_(malloc), VG_(free));

   configure_caches(&I1c, &D1c, &L2c);

   cachesim_I1_initcache(I1c);
   cachesim_D1_initcache(D1c);
   cachesim_L2_initcache(L2c);
}
Exemple #2
0
static void cg_post_clo_init(void)
{
   cache_t I1c, D1c, L2c; 

   configure_caches(&I1c, &D1c, &L2c);

   cachesim_I1_initcache(I1c);
   cachesim_D1_initcache(D1c);
   cachesim_L2_initcache(L2c);
}
static void cg_post_clo_init(void)
{
   cache_t I1c, D1c, L2c; 

   configure_caches(&I1c, &D1c, &L2c);

   cachesim_I1_initcache(I1c);
   cachesim_D1_initcache(D1c);
   cachesim_L2_initcache(L2c);

   VG_(register_profile_event)(VgpGetLineCC,     "get-lineCC");
   VG_(register_profile_event)(VgpCacheSimulate, "cache-simulate");
   VG_(register_profile_event)(VgpCacheResults,  "cache-results");
}