Apr 03 2008

今天实在很郁闷

Category: 乱up当秘笈ssmax @ 17:42:06

一早向总就过来说,研究一下jprof 啦,听ppyy说这个就说得多了,还没实际用过,立马去down了个rpm,想找台服务器来玩玩啦,发现手头上只有debain的空闲服务器了,ok,去down个tar source,编译,都知道编译的时候肯定n多问题的了,

首先就是找不到jni.h,加CPPFLAGS,解决之。。。

然后是jvmpi.h里面很多预定义常量都没有,上去sun上面查,原来已经不建议使用jvmpi了,在apache某位高人的email里面找到这些常量的定义,一个个手动加到系统的jvmpi.h里面,已经大汗了。。。

/* IBM-Specific Profiling Events */
#define JVMPI_EVENT_DISABLE_COMPATIBILITY         ((jint )2000)
#define JVMPI_EVENT_GEN_COMPILED_METHOD           ((jint )2001)
#define JVMPI_EVENT_GEN_INLINE_METHOD             ((jint )2002)
#define JVMPI_EVENT_GEN_BUILTIN_METHOD            ((jint )2003)
#define JVMPI_EVENT_COMPILED_METHOD_ENTRY         ((jint )2004)
#define JVMPI_EVENT_COMPILED_METHOD_ENTRY2        ((jint )2005)
#define JVMPI_EVENT_COMPILED_METHOD_EXIT          ((jint )2006)
#define JVMPI_EVENT_INLINE_METHOD_ENTRY           ((jint )2007)
#define JVMPI_EVENT_INLINE_METHOD_ENTRY2          ((jint )2008)
#define JVMPI_EVENT_BUILTIN_METHOD_ENTRY          ((jint )2009)
#define JVMPI_EVENT_BUILTIN_METHOD_ENTRY2         ((jint )2010)
#define JVMPI_EVENT_NATIVE_METHOD_ENTRY           ((jint )2011)
#define JVMPI_EVENT_NATIVE_METHOD_ENTRY2          ((jint )2012)
#define JVMPI_EVENT_COMPILING_START               ((jint )2013)
#define JVMPI_EVENT_COMPILING_END                 ((jint )2014)
#define JVMPI_EVENT_COMPILER_GC_START             ((jint )2015)
#define JVMPI_EVENT_COMPILER_GC_END               ((jint )2016)
#define JVMPI_EVENT_OBJ_ALLOC_FAILURE             ((jint )2017)
#define JVMPI_EVENT_COMPILED_METHOD_LOAD2         ((jint )2018)
#define JVMPI_EVENT_JLM                           ((jint )2019)
#define JVMPI_EVENT_JLMTS                         ((jint )2020)
#define JVMPI_EVENT_MONITOR_JLM_DUMP              ((jint )2021)
#define JVMPI_EVENT_TRANSFER                      ((jint )2022)
#define JVMPI_EVENT_SEGMENT                       ((jint )2023)
#define JVMPI_MIN_IBM_INTERNAL_OPTION_VAL ((jint) 2000)
#define JVMPI_MAX_IBM_INTERNAL_OPTION_VAL ((jint) 2023)
#define JVMPI_REQUESTED_EVENT   ((jint)0x10000000)
#define JVMPI_SUCCESS   ((jint)0)
#define JVMPI_NOT_AVAILABLE   ((jint)1)
#define JVMPI_FAIL    ((jint)-1)

struct
{
jmethodID method_id;
jobjectID obj_id;
jsize flags;
char *code_name;
jint edesc;
jint ld_ind;
void *code_addr;
jint code_size;
jint lineno_table_size;
JVMPI_Lineno *lineno_table;
} generic_compiled_method_load;

struct
{
jmethodID method_id;
jobjectID obj_id;
jsize flags;
char *code_name;
jint edesc;
jint ld_ind;
void *code_addr;
jint code_size;
jint lineno_table_size;
JVMPI_Lineno *lineno_table;
} generic_compiled_method_load;
struct
{
jmethodID method_id;
jobjectID obj_id;
jsize flags;
jint transfer_type;
jint transfer_status;
jint reserv3;
jint reserv4;
jint reserv5;
jint reserv6;
jint reserv7;
jint reserv8;
} generic_transfer_event;
struct
{
jmethodID method_id;
jobjectID obj_id;
jsize flags;
char *seg_name;
void *seg_addr;
jsize seg_size;
jint seg_type;
jint alloc_ind;
void *old_seg_addr;
jint reserv7;
jint reserv8;
} generic_segment_event;

继续编译。。。过了,但是jprof还是用不了,没有driver了,去装系统driver,出错

找不到profile.h ,手工改MakeFile指定路径。通过。

需要加入linux核心代码,找不到linux源代码地址。

apt-get install linux-source-2.6.18

apt-get install make-kpkg

make-kpkg configure

编译完,找到一个modpost的东东。。。。

然后编译出pitrace.ko

最后一步。。。insmod ,oh yeah, pitrace.ko 格式不正确,投降了。。。。

估计编译linux内核的时候要加 make-kpkg –append-to-version 6-686

清明回来再算了。。。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.