diff src/pt-unop.cc @ 12920:5d18231eee00

Extend profiling support to operators. * profiler.h: Always use std::string with profiler name instead of octave_function references for identifying functions. * profiler.cc: Adapt for that. * ov-builtin.cc: Ditto. * ov-mex-fcn.cc: Ditto. * ov-usr-fcn.cc: Ditto. * pt-binop.cc (tree_binary_expression::rvalue1): Collect profiler data. * pt-unop.cc (tree_prefix_expression::rvalue1): Ditto. (tree_postfix_expression::rvalue1): Ditto.
author Daniel Kraft <d@domob.eu>
date Fri, 29 Jul 2011 17:51:39 +0200
parents 12df7854fa7c
children 43d78e103984
line wrap: on
line diff
--- a/src/pt-unop.cc	Thu Jul 28 12:00:43 2011 -0400
+++ b/src/pt-unop.cc	Fri Jul 29 17:51:39 2011 +0200
@@ -28,6 +28,7 @@
 #include "oct-obj.h"
 #include "oct-lvalue.h"
 #include "ov.h"
+#include "profiler.h"
 #include "pt-bp.h"
 #include "pt-unop.h"
 #include "pt-walk.h"
@@ -72,6 +73,9 @@
 
           if (! error_state)
             {
+              profile_data_accumulator::enter pe (profiler,
+                                                  "prefix " + oper ());
+              
               ref.do_unary_op (etype);
 
               if (! error_state)
@@ -84,6 +88,9 @@
 
           if (! error_state && val.is_defined ())
             {
+              profile_data_accumulator::enter pe (profiler,
+                                                  "prefix " + oper ());
+
               // Attempt to do the operation in-place if it is unshared
               // (a temporary expression).
               if (val.get_count () == 1)
@@ -153,6 +160,9 @@
             {
               retval = ref.value ();
 
+              profile_data_accumulator::enter pe (profiler,
+                                                  "postfix " + oper ());
+
               ref.do_unary_op (etype);
             }
         }
@@ -162,6 +172,9 @@
 
           if (! error_state && val.is_defined ())
             {
+              profile_data_accumulator::enter pe (profiler,
+                                                  "postfix " + oper ());
+
               retval = ::do_unary_op (etype, val);
 
               if (error_state)