Merge branch 'tim-20120930-sizeme' of github.com:timbunce/devel-sizeme into tim-20120...
Tim Bunce [Thu, 11 Oct 2012 15:00:49 +0000 (16:00 +0100)]
Makefile.PL
SizeMe.xs
bin/sizeme_graph.pl

index 679218b..8a4e6c2 100644 (file)
@@ -27,8 +27,8 @@ WriteMakefile(
         # sizeme_graph.pl will eventually become a separate module
         #'Mojolicious::Lite' => 0,
         'Devel::Dwarn' => 0,
-        XSLoader => 0,
-        ORLite => 0,
+        'XSLoader' => 0,
+        'ORLite' => 0,
     },
     EXE_FILES => [ 'bin/sizeme_store.pl', 'bin/sizeme_graph.pl' ],
     clean => {
index 88921fc..1a7a251 100644 (file)
--- a/SizeMe.xs
+++ b/SizeMe.xs
@@ -243,7 +243,7 @@ static const char *svtypenames[SVt_LAST] = {
 };
 
 static NV
-gettimeofday_nv(void)
+gettimeofday_nv(pTHX_)
 {
 #ifdef HAS_GETTIMEOFDAY
     struct timeval when;
@@ -300,7 +300,7 @@ np_print_node_name(pTHX_ FILE *fp, npath_node_t *npath_node)
 }
 
 void
-np_dump_indent(int depth) {
+np_dump_indent(pTHX_ int depth) {
     while (depth-- > 0)
         fprintf(stderr, ":   ");
 }
@@ -342,7 +342,7 @@ np_dump_formatted_node(pTHX_ struct state *st, npath_node_t *npath_node, npath_n
     PERL_UNUSED_ARG(npath_node_deeper);
     if (0 && npath_node->type == NPtype_LINK)
         return 1;
-    np_dump_indent(npath_node->depth);
+    np_dump_indent(aTHX_ npath_node->depth);
     np_print_node_name(aTHX_ stderr, npath_node);
     if (npath_node->type == NPtype_LINK)
         fprintf(stderr, "->"); /* cosmetic */
@@ -357,7 +357,7 @@ np_dump_node_path_info(pTHX_ struct state *st, npath_node_t *npath_node, UV attr
     if (attr_type == NPattr_LEAFSIZE && !attr_value)
         return; /* ignore zero sized leaf items */
     np_walk_new_nodes(aTHX_ st, npath_node, NULL, np_dump_formatted_node);
-    np_dump_indent(npath_node->depth+1);
+    np_dump_indent(aTHX_ npath_node->depth+1);
     switch (attr_type) {
     case NPattr_LEAFSIZE:
         fprintf(stderr, "+%ld %s =%ld", attr_value, attr_name, attr_value+st->total_size);
@@ -1398,10 +1398,9 @@ else warn("skipped suspect HeVAL %p", HeVAL(cur_entry));
 static void
 free_memnode_state(pTHX_ struct state *st)
 {
-    /* PERL_UNUSED_ARG(aTHX); fails for non-threaded perl */
     if (st->node_stream_fh && st->node_stream_name && *st->node_stream_name) {
         fprintf(st->node_stream_fh, "E %d %f %s\n",
-            getpid(), gettimeofday_nv()-st->start_time_nv, "unnamed");
+            getpid(), gettimeofday_nv(aTHX)-st->start_time_nv, "unnamed");
         if (*st->node_stream_name == '|') {
             if (pclose(st->node_stream_fh))
                 warn("%s exited with an error status\n", st->node_stream_name);
@@ -1428,7 +1427,7 @@ new_state(pTHX)
     if (NULL != (warn_flag = get_sv("Devel::Size::dangle", FALSE))) {
        st->dangle_whine = SvIV(warn_flag) ? TRUE : FALSE;
     }
-    st->start_time_nv = gettimeofday_nv();
+    st->start_time_nv = gettimeofday_nv(aTHX);
     check_new(st, &PL_sv_undef);
     check_new(st, &PL_sv_no);
     check_new(st, &PL_sv_yes);
@@ -1494,7 +1493,7 @@ unseen_sv_size(pTHX_ struct state *st, pPATH)
 
 #ifdef PERL_MAD
 static void
-madprop_size(pTHX_ struct state *const st, pPath, MADPROP *prop)
+madprop_size(pTHX_ struct state *const st, pPATH, MADPROP *prop)
 {
   dPathNodes(2, NPathArg);
   if (!check_new(st, prop))
@@ -1525,7 +1524,7 @@ parser_size(pTHX_ struct state *const st, pPATH, yy_parser *parser)
   /*warn("foo: %u", parser->ps - parser->stack); */
   ADD_SIZE(st, "stack_frames", parser->stack_size * sizeof(yy_stack_frame));
   for (ps = parser->stack; ps <= parser->ps; ps++) {
-#if (PERL_BCDVERSION >= 0x5011001) /* roughly */
+#if (PERL_BCDVERSION >= 0x5011002) /* roughly */
     if (sv_size(aTHX_ st, NPathLink("compcv"), (SV*)ps->compcv, TOTAL_SIZE_RECURSION))
         ADD_LINK_ATTR(st, NPattr_NOTE, "i", ps - parser->ps);
 #else /* prior to perl 8c63ea58  Dec 8 2009 */
index b8530d6..71aa792 100755 (executable)
@@ -57,7 +57,7 @@ http://thejit.org/static/v20/Jit/Examples/Spacetree/example2.html
 use strict;
 use warnings;
 
-use Mojolicious::Lite;
+use Mojolicious::Lite; # possibly needs v3
 use JSON::XS;
 use Getopt::Long;
 use Storable qw(dclone);
@@ -128,11 +128,10 @@ get '/jit_tree/:id/:depth' => sub {
         return $jit_node;
     });
 
-    if(1){ # debug
-        use Devel::Dwarn;
-        use Data::Dump qw(pp);
+    if (1){ # debug
+        #use Data::Dump qw(pp);
         local $jit_tree->{children};
-        pp(dclone($jit_tree)); # dclone to avoid stringification
+        Dwarn(dclone($jit_tree)); # dclone to avoid stringification
     }
 
     $self->render_json($jit_tree);