[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog engine/cvm.h engine/cvm_call.c e...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog engine/cvm.h engine/cvm_call.c e... |
Date: |
Wed, 01 Oct 2008 15:35:40 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 08/10/01 15:35:39
Modified files:
. : ChangeLog
engine : cvm.h cvm_call.c cvmc.c cvmc_setup.c engine.h
Log message:
Redo enhanced profiling with CVM to be consistent with jit.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3569&r2=1.3570
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvm.h?cvsroot=dotgnu-pnet&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvm_call.c?cvsroot=dotgnu-pnet&r1=1.93&r2=1.94
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvmc.c?cvsroot=dotgnu-pnet&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvmc_setup.c?cvsroot=dotgnu-pnet&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/engine.h?cvsroot=dotgnu-pnet&r1=1.128&r2=1.129
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3569
retrieving revision 1.3570
diff -u -b -r1.3569 -r1.3570
--- ChangeLog 29 Sep 2008 12:53:37 -0000 1.3569
+++ ChangeLog 1 Oct 2008 15:35:38 -0000 1.3570
@@ -1,3 +1,25 @@
+2008-10-01 Klaus Treichel <address@hidden>
+
+ * engine/cvm.h (COP_PREFIX_PROFILE_START, COP_PREFIX_PROFILE_END): Add
+ two new opcodes for enhanced profiling support.
+
+ * engine/cvm_call.c (DO_PROFILING_START, DO_PROFILING_STOP): Remove the
+ now obsolete macros for enhanced profiling.
+ (COP_PREFIX_PROFILE_START, COP_PREFIX_PROFILE_END): Add processing of
the
+ two new opcodes for enhanced profiling.
+ (COP_PREFIX_PROFILE_COUNT): Wrap the native call in BEGIN_NATIVE_CALL
and
+ END_NATIVE_CALL.
+
+ * engine/cvmc.c (CVMCoder_ProfileStart, CVMCoder_ProfileEnd): Implement
+ the new enhanced profiling functions of the coder.
+
+ * engine/cvmc_setup.c (CVMEntryGen): Remove emitting
+ COP_PREFIX_PROFILE_COUNT here as this is done by _ILVerify now by
calling
+ ProfileStart now.
+
+ * engine/engine.h: Change profileTime in the call frame to ILInt64 to
+ hold a performance counter now.
+
2008-09-29 Klaus Treichel <address@hidden>
* engine/engine.h (_ILProfilingStart, _ILProfilingEnd): Change the
Index: engine/cvm.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- engine/cvm.h 21 Aug 2008 12:20:35 -0000 1.58
+++ engine/cvm.h 1 Oct 2008 15:35:39 -0000 1.59
@@ -1,7 +1,7 @@
/*
* cvm.h - Definitions for the "Converted Virtual Machine".
*
- * Copyright (C) 2001 Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -594,6 +594,13 @@
#define COP_PREFIX_SARRAY_CLEAR_AI4I4 0x91
/*
+ * Enhanced method profiling.
+ */
+#define COP_PREFIX_PROFILE_START 0x92
+#define COP_PREFIX_PROFILE_END 0x93
+
+
+/*
* Definition of a CVM stack word which can hold
* either 32-bit quantities or pointers.
*/
Index: engine/cvm_call.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_call.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- engine/cvm_call.c 14 Sep 2007 00:55:42 -0000 1.93
+++ engine/cvm_call.c 1 Oct 2008 15:35:39 -0000 1.94
@@ -1,7 +1,7 @@
/*
* cvm_call.c - Opcodes for performing calls to other methods.
*
- * Copyright (C) 2001 Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -59,49 +59,6 @@
#define FFI_RAW_CALL(cif,fn,rvalue,avalue)
#endif
-
-#ifdef ENHANCED_PROFILER
-/* Macros for simple profiling support.
- *
- * These macros get called whenever a function gets called and when it is left,
- * respectivly. They record the time a function needed to execute INCLUDING
- * CHILD FUNCTIONS. It's very dumb and simple but better than no time profiling
- * at all ;-)
- */
-#define DO_PROFILE_START() \
- if ((thread->profilingEnabled) && (callFrame) && ((ILCoderGetFlags
(thread->process->coder) & IL_CODER_FLAG_METHOD_PROFILE) != 0)) \
- { \
- gettimeofday (&callFrame->profileTime, 0); \
- }
-
-#define DO_PROFILE_STOP() \
- if ((thread->profilingEnabled) && (callFrame) && ((ILCoderGetFlags
(thread->process->coder) & IL_CODER_FLAG_METHOD_PROFILE) != 0)) \
- { \
- struct timeval endTime; \
- time_t seconds; \
- suseconds_t micros; \
- \
- gettimeofday (&endTime, 0); \
- \
- if (endTime.tv_usec < callFrame->profileTime.tv_usec) \
- { \
- seconds = endTime.tv_sec -
callFrame->profileTime.tv_sec - 1; \
- micros = (suseconds_t) ((1000000 + endTime.tv_usec) -
callFrame->profileTime.tv_usec); \
- } \
- else \
- { \
- seconds = endTime.tv_sec -
callFrame->profileTime.tv_sec; \
- micros = endTime.tv_usec -
callFrame->profileTime.tv_usec; \
- } \
- \
- method->time += micros + (seconds * 1000000); \
- }
-#else /* ENHANCED_PROFILER */
-#define DO_PROFILE_START()
-#define DO_PROFILE_STOP()
-#endif /* ENHANCED_PROFILER */
-
-
/*
* Allocate a new call frame.
*/
@@ -655,7 +612,6 @@
callFrame->frame = frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Pass control to the new method */
pc = (unsigned char *)(methodToCall->userData);
@@ -689,7 +645,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new method */
RESTORE_STATE_FROM_THREAD();
@@ -747,7 +702,6 @@
callFrame->frame = frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Pass control to the new method */
pc = ((unsigned char *)(methodToCall->userData)) -
CVM_CTOR_OFFSET;
@@ -780,7 +734,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new method */
RESTORE_STATE_FROM_THREAD();
@@ -993,7 +946,6 @@
callFrame->frame = frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Pass control to the new method */
pc = (unsigned char *)(methodToCall->userData);
@@ -1027,7 +979,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new
method */
RESTORE_STATE_FROM_THREAD();
@@ -1127,7 +1078,6 @@
callFrame->frame = frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Pass control to the new method */
pc = (unsigned char *)(methodToCall->userData);
@@ -1161,7 +1111,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new
method */
RESTORE_STATE_FROM_THREAD();
@@ -1245,8 +1194,6 @@
callFrame = &(thread->frameStack[--(thread->numFrames)]);
- DO_PROFILE_STOP();
-
methodToCall = callFrame->method;
pc = callFrame->pc;
thread->exceptHeight = callFrame->exceptHeight;
@@ -1545,7 +1492,6 @@
callFrame->frame = frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Pass control to the new method */
pc = (unsigned char *)(methodToCall->userData);
@@ -1579,7 +1525,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new method */
RESTORE_STATE_FROM_THREAD();
@@ -1639,7 +1584,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new method */
RESTORE_STATE_FROM_THREAD();
@@ -1707,7 +1651,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new method */
RESTORE_STATE_FROM_THREAD();
@@ -1967,7 +1910,6 @@
callFrame->frame = frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Pass control to the new method */
pc = (unsigned char *)(methodToCall->userData);
@@ -2001,7 +1943,6 @@
callFrame->frame = thread->frame;
callFrame->exceptHeight = thread->exceptHeight;
callFrame->permissions = 0;
- DO_PROFILE_START();
/* Restore the state information and jump to the new
method */
RESTORE_STATE_FROM_THREAD();
@@ -2182,18 +2123,9 @@
*/
VMCASE(COP_PREFIX_PROFILE_COUNT):
{
-#ifdef ENHANCED_PROFILER
- /* If the enhanced profiler is selected then don't count when
- * profiling is disabled
- * (e.g. via DotGNU.Misc.Profiling.StopProfiling())
- */
- if ((thread->profilingEnabled) && ((ILCoderGetFlags
(thread->process->coder) & IL_CODER_FLAG_METHOD_PROFILE) != 0))
- {
-#endif
+ BEGIN_NATIVE_CALL();
ILInterlockedIncrement(&method->count);
-#ifdef ENHANCED_PROFILER
- }
-#endif
+ END_NATIVE_CALL();
MODIFY_PC_AND_STACK(CVMP_LEN_NONE,0);
}
VMBREAK(COP_PREFIX_PROFILE_COUNT);
@@ -2326,6 +2258,69 @@
}
VMBREAK(COP_PREFIX_TRACE_OUT);
+/**
+ *<opcode name="profile_start" group="Profiling Instructions">
+ * <operation>Record the start performance counter for the current method
+ * invokation</operation>
+ *
+ * <format>profile_start</format>
+ * <dformat>{profile_start}</dformat>
+ *
+ * <form name="profile_start" code="COP_PREFIX_PROFILE_START"/>
+ *
+ * <description>This instruction records the start performance counter for
+ * the current method invokation. It is inserted at the beginning of the
+ * method's code by the CVM coder if the engine is built with enhanced
+ * profiling support and profiling is enabled.</description>
+ * </opcode>
+ */
+VMCASE(COP_PREFIX_PROFILE_START):
+{
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+#ifdef ENHANCED_PROFILER
+ if(callFrame)
+ {
+ BEGIN_NATIVE_CALL();
+ _ILProfilingStart(&(callFrame->profileTime));
+ END_NATIVE_CALL();
+ }
+#endif /* ENHANCED_PROFILER */
+#endif /* !IL_CONFIG_REDUCE_CODE && !IL_WITHOUT_TOOLS */
+ MODIFY_PC_AND_STACK(CVMP_LEN_NONE,0);
+}
+VMBREAK(COP_PREFIX_PROFILE_START);
+/**
+ *<opcode name="profile_end" group="Profiling Instructions">
+ * <operation>Record the time spend in the method and increase the number
of
+ * invokations for the method</operation>
+ *
+ * <format>profile_end</format>
+ * <dformat>{profile_end}</dformat>
+ *
+ * <form name="profile_end" code="COP_PREFIX_PROFILE_END"/>
+ *
+ * <description>This instruction retrieves the end performance counter for
+ * the current method invokation. It adds the difference between start and
+ * end to the total time spend in the method and increases the number of
+ * invokations of the method by one if the engine is built with enhanced
+ * profiling support and profiling is enabled for the current
thread.</description>
+ * </opcode>
+ */
+VMCASE(COP_PREFIX_PROFILE_END):
+{
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+#ifdef ENHANCED_PROFILER
+ if(thread->profilingEnabled && callFrame)
+ {
+ BEGIN_NATIVE_CALL();
+ _ILProfilingEnd(method, &(callFrame->profileTime));
+ END_NATIVE_CALL();
+ }
+#endif /* ENHANCED_PROFILER */
+#endif /* !IL_CONFIG_REDUCE_CODE && !IL_WITHOUT_TOOLS */
+ MODIFY_PC_AND_STACK(CVMP_LEN_NONE,0);
+}
+VMBREAK(COP_PREFIX_PROFILE_END);
#endif /* IL_CVM_PREFIX */
Index: engine/cvmc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvmc.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- engine/cvmc.c 24 Aug 2008 17:45:25 -0000 1.61
+++ engine/cvmc.c 1 Oct 2008 15:35:39 -0000 1.62
@@ -1,7 +1,7 @@
/*
* cvmc.c - Coder implementation for CVM output.
*
- * Copyright (C) 2001 Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -328,17 +328,25 @@
/*
* Start profiling of the current method.
*/
-static void CVMCoder_ProfilingStart(ILCoder *_coder)
+static void CVMCoder_ProfileStart(ILCoder *_coder)
{
- /* TODO */
+ ILCVMCoder *coder = (ILCVMCoder *)_coder;
+#ifdef ENHANCED_PROFILER
+ CVMP_OUT_NONE(COP_PREFIX_PROFILE_START);
+#else
+ CVMP_OUT_NONE(COP_PREFIX_PROFILE_COUNT);
+#endif
}
/*
* End profiling of the current method.
*/
-static void CVMCoder_ProfilingEnd(ILCoder *_coder)
+static void CVMCoder_ProfileEnd(ILCoder *_coder)
{
- /* TODO */
+#ifdef ENHANCED_PROFILER
+ ILCVMCoder *coder = (ILCVMCoder *)_coder;
+ CVMP_OUT_NONE(COP_PREFIX_PROFILE_END);
+#endif
}
static void CVMCoder_SetOptimizationLevel(ILCoder *_coder,
@@ -612,8 +620,8 @@
CVMCoder_RunCCtors,
CVMCoder_RunCCtor,
CVMCoder_HandleLockedMethod,
- CVMCoder_ProfilingStart,
- CVMCoder_ProfilingEnd,
+ CVMCoder_ProfileStart,
+ CVMCoder_ProfileEnd,
CVMCoder_SetOptimizationLevel,
CVMCoder_GetOptimizationLevel,
"sentinel"
Index: engine/cvmc_setup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvmc_setup.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- engine/cvmc_setup.c 10 Mar 2007 21:54:57 -0000 1.47
+++ engine/cvmc_setup.c 1 Oct 2008 15:35:39 -0000 1.48
@@ -1,7 +1,7 @@
/*
* cvmc_setup.c - Coder implementation for CVM method entry setup.
*
- * Copyright (C) 2001 Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -334,12 +334,6 @@
coder->stackCheck = CVM_POSN();
CVM_OUT_CKHEIGHT();
- /* Output the CVM code to do the profiling of the methods*/
- if((coder->flags & IL_CODER_FLAG_METHOD_PROFILE) != 0)
- {
- CVMP_OUT_NONE(COP_PREFIX_PROFILE_COUNT);
- }
-
#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
if(((ILCVMCoder*)coder)->flags & IL_CODER_FLAG_METHOD_TRACE)
{
Index: engine/engine.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -b -r1.128 -r1.129
--- engine/engine.h 29 Sep 2008 10:53:06 -0000 1.128
+++ engine/engine.h 1 Oct 2008 15:35:39 -0000 1.129
@@ -387,7 +387,7 @@
CVMWord *exceptHeight; /* Height of the frame for
exceptions */
void *permissions; /* Permissions for this stack frame */
#ifdef ENHANCED_PROFILER
- struct timeval profileTime;
+ ILInt64 profileTime; /* Preformance counter for
profiling */
#endif
} ILCallFrame;
#define IL_INVALID_PC ((unsigned char *)(ILNativeInt)(-1))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog engine/cvm.h engine/cvm_call.c e...,
Klaus Treichel <=