Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OML support #206

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config-userlevel.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
#ifndef CLICK_CONFIG_USERLEVEL_H
#define CLICK_CONFIG_USERLEVEL_H

/* Define to use OML (OMF Measurement Library) */
#undef CLICK_OML

/* Define if you have Sigar header file */
#undef HAVE_LIBSIGAR_SIGAR_H
#undef HAVE_SIGAR_H

/* Define if you have the __thread storage class specifier. */
#undef HAVE___THREAD_STORAGE_CLASS

Expand Down
46 changes: 46 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ enable_nanotimestamp
enable_bound_port_transfer
enable_tools
enable_dynamic_linking
enable_oml
enable_stats
enable_stride
enable_task_heap
Expand Down Expand Up @@ -1524,6 +1525,7 @@ Optional Features:
--enable-bound-port-transfer enable port transfer function ptr optimization
--enable-tools=WHERE enable tools (host/build/mixed/no) [mixed]
--disable-dynamic-linking disable dynamic linking
--enable-oml enable use of OML (OMF Measurement Library)
--enable-stats[=LEVEL] enable statistics collection
--disable-stride disable stride scheduler
--enable-task-heap use heap for task list
Expand Down Expand Up @@ -10069,6 +10071,50 @@ fi



# Check whether --enable-oml was given.
if test "${enable_oml+set}" = set; then :
enableval=$enable_oml; :
else
enable_oml=no
fi

if test "$enable_oml" = yes; then

ac_fn_cxx_check_header_mongrel "$LINENO" "oml2/omlc.h" "ac_cv_header_oml2_omlc_h" "$ac_includes_default"
if test "x$ac_cv_header_oml2_omlc_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define CLICK_OML
_ACEOF
LIBS="-loml2 $LIBS"
else
as_fn_error $? "
=========================================

Can't find OML header file 'oml2/omlc.h'.
Try again without '--enable-oml'.

=========================================" "$LINENO" 5
fi
fi

# Check whether Sigar header file is available.
ac_fn_cxx_check_header_mongrel "$LINENO" "libsigar/sigar.h" "ac_cv_header_libsigar_sigar_h" "$ac_includes_default"
if test "x$ac_cv_header_libsigar_sigar_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSIGAR_SIGAR_H
_ACEOF
LIBS="-lsigar $LIBS"
else
ac_fn_cxx_check_header_mongrel "$LINENO" "sigar.h" "ac_cv_header_sigar_h" "$ac_includes_default"
if test "x$ac_cv_header_sigar_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SIGAR_H
_ACEOF
LIBS="-lsigar $LIBS"
fi
fi


# Check whether --enable-stats was given.
if test "${enable_stats+set}" = set; then :
enableval=$enable_stats; :
Expand Down
7 changes: 7 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,13 @@ dnl
dnl more features
dnl

dnl OML

AC_ARG_ENABLE(oml, [[ --enable-oml enable OML]], :, enable_oml=no)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably wants to be AC_ARG_WITH (see later for examples)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is done

2015-07-30 18:26 GMT+03:00 Eddie Kohler [email protected]:

In configure.in
#206 (comment):

@@ -993,6 +993,13 @@ dnl
dnl more features
dnl

+dnl OML
+
+AC_ARG_ENABLE(oml, [[ --enable-oml enable OML]], :, enable_oml=no)

Probably wants to be AC_ARG_WITH (see later for examples)


Reply to this email directly or view it on GitHub
https://github.com/kohler/click/pull/206/files#r35882953.

if test "$enable_oml" = yes; then
AC_DEFINE_UNQUOTED([CLICK_OML], $enable_oml)
fi

dnl statistics

AC_ARG_ENABLE(stats, [[ --enable-stats[=LEVEL] enable statistics collection]], :, enable_stats=no)
Expand Down
18 changes: 18 additions & 0 deletions userlevel/click.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
#include <click/handlercall.hh>
#include "elements/standard/quitwatcher.hh"
#include "elements/userlevel/controlsocket.hh"
#ifdef CLICK_OML
#include "/usr/include/oml2/omlc.h"
#endif
CLICK_USING_DECLS

#define HELP_OPT 300
Expand Down Expand Up @@ -497,6 +500,17 @@ main(int argc, char **argv)
errh = ErrorHandler::default_handler();

// read command line arguments
#ifdef CLICK_OML
if (omlc_init("click", &argc, (const char**)argv, NULL) == -1)
errh->warning("Couldn't initialize OML\n");
for(int i=1; i<argc; ) {
if(!strncmp(argv[i], "--oml", 5)) {
for(int j=i; j<argc-1; j++) argv[j] = argv[j+1];
argc--;
}
else i++;
}
#endif
Clp_Parser *clp =
Clp_NewParser(argc, argv, sizeof(options) / sizeof(options[0]), options);
program_name = Clp_ProgramName(clp);
Expand Down Expand Up @@ -679,6 +693,10 @@ particular purpose.\n");
Vector<pthread_t> other_threads;
pthread_mutex_init(&hotswap_lock, 0);
#endif
#ifdef CLICK_OML
if (omlc_start() == -1)
errh->error("Error starting up OML measurement streams\n");
#endif

// output flat configuration
if (output_file) {
Expand Down