src/solaris/demo/jvmti/hprof/hprof_md.c
Print this page
rev 8725 : 8024854: Basic changes and files to build the class library on AIX
Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, thomas.stuefe@sap.com
Reviewed-by: alanb, prr, sla, chegar, michaelm, mullan
*** 1,7 ****
/*
! * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
--- 1,7 ----
/*
! * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*** 40,50 ****
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
! #if !defined(LINUX) && !defined(_ALLBSD_SOURCE)
#include <procfs.h>
#endif
#include <stdio.h>
#include <stdlib.h>
--- 40,50 ----
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
! #if !defined(LINUX) && !defined(_ALLBSD_SOURCE) && !defined(AIX)
#include <procfs.h>
#endif
#include <stdio.h>
#include <stdlib.h>
*** 63,72 ****
--- 63,76 ----
#include "jni.h"
#include "jvm_md.h"
#include "hprof.h"
+ #ifdef AIX
+ #include "porting_aix.h" /* For the 'dladdr' function. */
+ #endif
+
int
md_getpid(void)
{
static int pid = -1;
*** 84,94 ****
}
void
md_init(void)
{
! #if defined(LINUX) || defined(_ALLBSD_SOURCE)
/* No Hi-Res timer option? */
#else
if ( gdata->micro_state_accounting ) {
char proc_ctl_fn[48];
int procfd;
--- 88,98 ----
}
void
md_init(void)
{
! #if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
/* No Hi-Res timer option? */
#else
if ( gdata->micro_state_accounting ) {
char proc_ctl_fn[48];
int procfd;
*** 251,261 ****
/* Hi-res timer in micro-seconds */
jlong
md_get_microsecs(void)
{
! #if defined(LINUX) || defined(_ALLBSD_SOURCE)
return (jlong)(md_timeofday() * (jlong)1000); /* Milli to micro */
#else
return (jlong)(gethrtime()/(hrtime_t)1000); /* Nano seconds to micro seconds */
#endif
}
--- 255,265 ----
/* Hi-res timer in micro-seconds */
jlong
md_get_microsecs(void)
{
! #if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
return (jlong)(md_timeofday() * (jlong)1000); /* Milli to micro */
#else
return (jlong)(gethrtime()/(hrtime_t)1000); /* Nano seconds to micro seconds */
#endif
}
*** 269,279 ****
/* Current CPU hi-res CPU time used */
jlong
md_get_thread_cpu_timemillis(void)
{
! #if defined(LINUX) || defined(_ALLBSD_SOURCE)
return md_timeofday();
#else
return (jlong)(gethrvtime()/1000); /* Nano seconds to milli seconds */
#endif
}
--- 273,283 ----
/* Current CPU hi-res CPU time used */
jlong
md_get_thread_cpu_timemillis(void)
{
! #if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
return md_timeofday();
#else
return (jlong)(gethrvtime()/1000); /* Nano seconds to milli seconds */
#endif
}
*** 284,294 ****
void *addr;
char libdir[FILENAME_MAX+1];
Dl_info dlinfo;
libdir[0] = 0;
! #if defined(LINUX) || defined(_ALLBSD_SOURCE)
addr = (void*)&Agent_OnLoad;
#else
/* Just using &Agent_OnLoad will get the first external symbol with
* this name in the first .so, which may not be libhprof.so.
* On Solaris we can actually ask for the address of our Agent_OnLoad.
--- 288,298 ----
void *addr;
char libdir[FILENAME_MAX+1];
Dl_info dlinfo;
libdir[0] = 0;
! #if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
addr = (void*)&Agent_OnLoad;
#else
/* Just using &Agent_OnLoad will get the first external symbol with
* this name in the first .so, which may not be libhprof.so.
* On Solaris we can actually ask for the address of our Agent_OnLoad.
*** 455,459 ****
--- 459,465 ----
void * sym;
sym = dlsym(handle, name);
return sym;
}
+
+