{ size_t n; for (n = 0; n < symidx; ++n) if (sortsym[n]->ticks != 0) printf ("Name: %-30s, Ticks: %" PRIdMAX "\n", sortsym[n]->name, sortsym[n]->ticks); printf ("Total ticks: %" PRIdMAX "\n", total_ticks); }
main (int argc, char *argv[]){  const char *shobj;  const char *profdata;  struct shobj *shobj_handle;  struct profdata *profdata_handle;  int remaining;  setlocale (LC_ALL, "");  /* Initialize the message catalog.  */  textdomain (_libc_intl_domainname);  /* Parse and process arguments.  */  argp_parse (&argp, argc, argv, 0, &remaining, NULL);  if (argc - remaining == 0 || argc - remaining > 2)    {      /* We need exactly two non-option parameter.  */      argp_help (&argp, stdout, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR,                 program_invocation_short_name);      exit (1);    }  /* Get parameters.  */  shobj = argv[remaining];  if (argc - remaining == 2)    profdata = argv[remaining + 1];  else    /* No filename for the profiling data given.  We will determine it       from the soname of the shobj, later.  */    profdata = NULL;  /* First see whether we can load the shared object.  */  shobj_handle = load_shobj (shobj);  if (shobj_handle == NULL)    exit (1);  /* We can now determine the filename for the profiling data, if     nececessary.  */  if (profdata == NULL)    {      char *newp;      if (shobj_handle->soname == NULL)	{	  unload_shobj (shobj_handle);	  error (EXIT_FAILURE, 0, _("\no filename for profiling data given and shared object `%s' has no soname"),		 shobj);	}      newp = (char *) alloca (strlen (shobj_handle->soname)			      + sizeof ".profile");      stpcpy (stpcpy (newp, shobj_handle->soname), ".profile");      profdata = newp;    }  /* Now see whether the profiling data file matches the given object.   */  profdata_handle = load_profdata (profdata, shobj_handle);  if (profdata_handle == NULL)    {      unload_shobj (shobj_handle);      exit (1);    }  read_symbols (shobj_handle);  /* Do some work.  */  switch (mode)    {    case COUNT_TOTAL:      count_total_ticks (shobj_handle, profdata_handle);      break;    case NONE:      /* Do nothing.  */      break;    default:      assert (! "Internal error");    }  /* Free the resources.  */  unload_shobj (shobj_handle);  unload_profdata (profdata_handle);  return 0;}