Skip to content

Commit

Permalink
move profile funcs/stubs out to memprof file
Browse files Browse the repository at this point in the history
Guard these using existing OPAL_ENABLE_MEM_PROFILE option
that is enabled via '--enable-mem-profile' configury.
  • Loading branch information
naughtont3 committed May 30, 2019
1 parent f070e1c commit a4f9d1c
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 29 deletions.
1 change: 1 addition & 0 deletions config/opal_configure_options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ else
fi
AC_DEFINE_UNQUOTED(OPAL_ENABLE_MEM_PROFILE, $WANT_MEM_PROFILE,
[Whether we want the memory profiling or not])
AM_CONDITIONAL([OPAL_ENABLE_MEM_PROFILE], [test "$WANT_MEM_PROFILE" = "1"])

#
# Developer picky compiler options
Expand Down
24 changes: 1 addition & 23 deletions opal/class/opal_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,8 @@
#include "opal/sys/atomic.h"
#include "opal/class/opal_object.h"
#include "opal/constants.h"
#include "opal/util/memprof.h"

void __attribute__((weak)) Tau_track_class_allocation(const char * name, size_t size) {

}

void __attribute__((weak)) Tau_track_class_deallocation(const char * name, size_t size) {

}

void __attribute__((weak)) Tau_start_class_allocation(const char * name, size_t size, int include_in_parent) {

}

void __attribute__((weak)) Tau_stop_class_allocation(const char * name, int record) {

}

void __attribute__((weak)) Tau_start_class_deallocation(const char * name, size_t size, int include_in_parent) {

}

void __attribute__((weak)) Tau_stop_class_deallocation(const char * name, int record) {

}

/*
* Instantiation of class descriptor for the base class. This is
Expand Down
7 changes: 1 addition & 6 deletions opal/class/opal_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
#include <stdlib.h>

#include "opal/threads/thread_usage.h"
#include "opal/util/memprof.h"

BEGIN_C_DECLS

Expand All @@ -132,12 +133,6 @@ BEGIN_C_DECLS
#define OPAL_OBJ_MAGIC_ID ((0xdeafbeedULL << 32) + 0xdeafbeedULL)
#endif

void __attribute__((weak)) Tau_track_class_allocation(const char * name, size_t size);
void __attribute__((weak)) Tau_track_class_deallocation(const char * name, size_t size);
void __attribute__((weak)) Tau_start_class_allocation(const char * name, size_t size, int include_in_parent);
void __attribute__((weak)) Tau_stop_class_allocation(const char * name, int record);
void __attribute__((weak)) Tau_start_class_deallocation(const char * name, size_t size, int include_in_parent);
void __attribute__((weak)) Tau_stop_class_deallocation(const char * name, int record);

/* typedefs ***********************************************************/

Expand Down
7 changes: 7 additions & 0 deletions opal/util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# Copyright (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
# Copyright (c) 2019 UT-Battelle, LLC. All rights reserved.
#
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -55,6 +57,7 @@ headers = \
if.h \
keyval_parse.h \
malloc.h \
memprof.h \
net.h \
numtostr.h \
opal_environ.h \
Expand Down Expand Up @@ -119,6 +122,10 @@ if OPAL_COMPILE_TIMING
libopalutil_la_SOURCES += timings.c
endif

if OPAL_ENABLE_MEM_PROFILE
libopalutil_la_SOURCES += memprof.c
endif

libopalutil_la_LIBADD = \
keyval/libopalutilkeyval.la
libopalutil_la_DEPENDENCIES = \
Expand Down
45 changes: 45 additions & 0 deletions opal/util/memprof.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2019 UT-Battelle, LLC. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

#include "opal_config.h"
#include "opal/util/memprof.h"


void __attribute__((weak)) Tau_track_class_allocation(const char * name,
size_t size) {

}

void __attribute__((weak)) Tau_track_class_deallocation(const char * name,
size_t size) {

}

void __attribute__((weak)) Tau_start_class_allocation(const char * name,
size_t size,
int include_in_parent) {

}

void __attribute__((weak)) Tau_stop_class_allocation(const char * name,
int record) {

}

void __attribute__((weak)) Tau_start_class_deallocation(const char * name,
size_t size,
int include_in_parent) {

}

void __attribute__((weak)) Tau_stop_class_deallocation(const char * name,
int record) {

}
39 changes: 39 additions & 0 deletions opal/util/memprof.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2018 UT-Battelle, LLC. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

#ifndef OPAL_MEMPROF_H
#define OPAL_MEMPROF_H

BEGIN_C_DECLS

#if OPAL_ENABLE_MEM_PROFILE

void __attribute__((weak)) Tau_track_class_allocation(const char * name, size_t size);
void __attribute__((weak)) Tau_track_class_deallocation(const char * name, size_t size);
void __attribute__((weak)) Tau_start_class_allocation(const char * name, size_t size, int include_in_parent);
void __attribute__((weak)) Tau_stop_class_allocation(const char * name, int record);
void __attribute__((weak)) Tau_start_class_deallocation(const char * name, size_t size, int include_in_parent);
void __attribute__((weak)) Tau_stop_class_deallocation(const char * name, int record);

#endif /* OPAL_ENABLE_MEM_PROFILE */

END_C_DECLS

#endif /* OPAL_MEMPROF_H */

0 comments on commit a4f9d1c

Please sign in to comment.