1818#endif 
1919#include  < pcu_util.h> 
2020
21- #ifdef  __bgq__
22- #include  < spi/include/kernel/memory.h> 
23- 
24- static  double  get_peak ()
25- {
26-   uint64_t  heap;
27-   Kernel_GetMemorySize (KERNEL_MEMSIZE_HEAP, &heap);
28-   return  heap;
29- }
30- 
31- #elif  defined (__linux__)
32- 
33- static  double  get_peak ()
34- {
35- #if  defined(__GNUG__) && defined(PUMI_HAS_MALLINFO2)
36-   return  mallinfo2 ().arena ;
37- #elif  defined(__GNUG__)
38-   return  mallinfo ().arena ;
39- #endif 
40- }
41- 
42- #else 
43- 
44- static  double  get_peak ()
45- {
46-   if (!PCU_Comm_Self ())
47-     printf (" %s:%d: OS Not supported\n " 
48-   return (-1.0 );
49- }
50- 
51- #endif 
52- 
5321static  void  print_stats (const  char * name, double  value)
5422{
5523  double  min, max, avg;
@@ -62,27 +30,6 @@ static void print_stats(const char* name, double value)
6230    printf (" %s: min %f max %f avg %f imb %f\n " 
6331}
6432
65- #if  defined(__linux__)
66- 
67- static  double  get_chunks ()
68- {
69- #if  defined(__GNUG__) && defined(PUMI_HAS_MALLINFO2)
70-   struct  mallinfo2  m = mallinfo2 ();
71- #elif  defined(__GNUG__)
72-   struct  mallinfo  m = mallinfo ();
73- #endif 
74-   return  m.uordblks  + m.hblkhd ;
75- }
76- 
77- #else 
78- static  double  get_chunks ()
79- {
80-   if (!PCU_Comm_Self ())
81-     printf (" %s:%d: OS Not supported\n " 
82-   return (-1.0 );
83- }
84- #endif 
85- 
8633static  void  list_tags (apf::Mesh* m)
8734{
8835  if  (PCU_Comm_Self ())
@@ -107,11 +54,10 @@ int main(int argc, char** argv)
10754  gmi_register_sim ();
10855#endif 
10956  gmi_register_mesh ();
110-   print_stats (" malloc  used before" get_chunks ());
57+   print_stats (" kernel  used before" PCU_GetMem ());
11158  apf::Mesh2* m = apf::loadMdsMesh (argv[1 ],argv[2 ]);
11259  m->verify ();
113-   print_stats (" kernel heap" get_peak ());
114-   print_stats (" malloc used" get_chunks ());
60+   print_stats (" kernel heap" PCU_GetMem ());
11561  Parma_PrintPtnStats (m, " " 
11662  list_tags (m);
11763  m->destroyNative ();
0 commit comments