IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42043


Ignore:
Timestamp:
Feb 17, 2022, 11:48:54 AM (4 years ago)
Author:
eugene
Message:

add a function to print Ohana memblock info

Location:
branches/eam_branches/ipp-20211108/Ohana/src/libohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20211108/Ohana/src/libohana/include/ohana_allocate.h

    r41341 r42043  
    4747void ohana_memdump_strings_file (FILE *f, int VERBOSE);
    4848void ohana_memdump_set_maxlines (int N);
     49void ohana_memblock_show_stats (void *in);
    4950
    5051# define ohana_memcheck(X) ohana_memcheck_func (__FILE__, __LINE__, __func__, X)
  • branches/eam_branches/ipp-20211108/Ohana/src/libohana/src/ohana_allocate.c

    r41560 r42043  
    754754  NblockMaxDump = N;
    755755}
     756
     757void ohana_memblock_show_stats (void *in) {
     758
     759  OhanaMemblock *ref;
     760
     761  if (!in) { fprintf (stderr, "void pointer\n"); return; }
     762
     763  if (!lastBlock) { fprintf (stderr, "no memory allocated yet\n"); return; }
     764
     765  ref = (OhanaMemblock *) in - 1;
     766
     767  fprintf (stderr, "file: %s\n", ref->file);
     768  fprintf (stderr, "line: %d\n", ref->line);
     769  fprintf (stderr, "func: %s\n", ref->func);
     770 
     771  fprintf (stderr, "size: %zd\n", ref->size);
     772
     773  fprintf (stderr, "start post: 0x%08x\n", ref->startblock);
     774  fprintf (stderr, "end  block: 0x%08x\n", ref->endblock);
     775
     776  // pointer to the start of the user memory
     777  char *ptr = (char *)(in) + ref->size;
     778  uint32_t endpost = *(uint32_t *) ptr;
     779
     780  fprintf (stderr, "end   post: 0x%08x\n", endpost);
     781}
Note: See TracChangeset for help on using the changeset viewer.