[prev in list] [next in list] [prev in thread] [next in thread] 

List:       oprofile-commits
Subject:    [oprof-cvs] CVS: oprofile/agents/jvmpi jvmpi_oprofile.cpp, 1.1.2.2,
From:       Maynard Johnson <maynardj () users ! sourceforge ! net>
Date:       2007-12-14 22:46:32
Message-ID: E1J3JIe-0002b8-LS () sc8-pr-cvs3 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/oprofile/oprofile/agents/jvmpi
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9808/agents/jvmpi

Modified Files:
      Tag: JIT_SUPPORT
	jvmpi_oprofile.cpp 
Log Message:
Make libopagent thread safe; fix regression bug

Index: jvmpi_oprofile.cpp
===================================================================
RCS file: /cvsroot/oprofile/oprofile/agents/jvmpi/Attic/jvmpi_oprofile.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -p -d -r1.1.2.2 -r1.1.2.3
--- jvmpi_oprofile.cpp	10 Dec 2007 23:40:47 -0000	1.1.2.2
+++ jvmpi_oprofile.cpp	14 Dec 2007 22:46:30 -0000	1.1.2.3
@@ -19,11 +19,13 @@
 extern "C" {
 #include <jvmpi.h>
 #include <libopagent.h>
+#include <errno.h>
 }
 
 using namespace std;
 
 static int debug = 0;
+static op_agent_t agent_hdl;
 
 class Class_details {
  public:
@@ -115,7 +117,7 @@ void compiled_method_load(JVMPI_Event *e
 	strncpy(buf, class_signature.c_str(), cnt - 1);
 	strncat(buf, method_name, cnt - strlen(buf) - 1);
 	strncat(buf, method_signature, cnt - strlen(buf) - 1);
-	op_write_native_code(buf, code_addr, code_size);
+	op_write_native_code(agent_hdl, buf, code_addr, code_size);
 }
 
 void compiled_method_unload(JVMPI_Event *event)
@@ -126,7 +128,7 @@ void compiled_method_unload(JVMPI_Event 
 			<< (unsigned long long) (uintptr_t) code_addr
 			<< endl;
 	}
-	op_unload_native_code(code_addr);
+	op_unload_native_code(agent_hdl, code_addr);
 }
 
 void jvm_shutdown(JVMPI_Event *event)
@@ -135,7 +137,7 @@ void jvm_shutdown(JVMPI_Event *event)
 	 * the 'unused parameter' compiler warning.
 	 */
 	if (event)
-		op_close_agent();
+		op_close_agent(agent_hdl);
 }
 
 
@@ -180,9 +182,9 @@ JNIEXPORT jint JNICALL JVM_OnLoad(JavaVM
 		}
 	}
 
-	err = op_open_agent();
-	if (err) {
-		cerr << "ERROR: op_open_agent, rc=" << err << endl;
+	agent_hdl = op_open_agent();
+	if (!agent_hdl) {
+		cerr << "ERROR: op_open_agent, rc=" << errno << endl;
 		throw runtime_error("Exiting");
 	}
 


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Oprofile-commits mailing list
Oprofile-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic