Hello all, I have been taking basic steps with DTrace and subscribed today to this list. I have written a simple DTrace script to trace all the function entry/exit from a given function:
#pragma D option flowindent pid$1::*mysql_select*:entry { self -> start = vtimestamp ; } pid$1::*mysql_select*:return /self -> start/ { self -> start =0 ; } pid$1:::entry, pid$1:::return /self->start/ { trace (vtimestamp - self->start); } sample output: 0 -> __1cMmysql_select6FpnDTHD_pppnEItem_pnKTABLE_LIST_IrnEList4n0B___p2IpnIst_or der_9D39DXpnNselect_result_pnSst_select_lex_unit_pn 0 0 -> _db_enter_ 340930 0 -> code_state 415816 0 -> my_thread_var_dbug 516399 0 -> pthread_getspecific 597094 0 <- pthread_getspecific 669144 0 <- my_thread_var_dbug . . <please ignore the 3rd column; I need to correct it> Basically, I would like to have a graphical display showing me the call flow between the various functions- starting and ending at the starting function. I have thought about it a bit. I have written a regex to identify the various columns. After some intermediate data storage using a stack, I shall use the information to prepare a 'dot' file which I plan to feed to 'dotty' (Graphviz) to give me the call graph. Is this a good approach? Has anybody tried something similar? This blog post http://blogs.sun.com/realneel/entry/visualizing_callstacks_via_dtrace_and by Neelkanth comes closest, but the motives are dissimilar. Initially I tried to tweak it for my purpose. I thought, a 'regex' based approach would be generic. (I am not sure). I would appreciate any feedback and comments. Thanks, Amit -- Amit Kumar Saha http://amitksaha.blogspot.com http://amitsaha.in.googlepages.com/ Skype: amitkumarsaha _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org