Thanks, yes, i am currently prototyping. For simplicity i process all pushes to a stack. Once a pop comes in i will store the stack data. Thus i get the stack usage over execution time. By simply appending the functions to each other i can use regex for matching without big effort. In the end it is simpler than expected :-)

Here my prototype in case of interrest

package CallStackAnalyzer; use strict; use warnings; use diagnostics; sub new { my $self = { name => 'CallStackAnalyzer', tracefilecontent => undef, stack => [], stacktraces => {}, direction => '', }; bless $self; return $self; } sub TraceFile{ my $self = shift; $self->{tracefilecontent} = shift; _AnalyzeTraceFile($self); } sub _AnalyzeTraceFile{ my $self = shift; my @trace = @{$self->{tracefilecontent}}; foreach my $line (@trace){ if($line=~m/^(ENTRY):\s+\S+\s+\S+\s+(\S+)\(\)/){ push(@{$self->{stack}}, $2) && ($self->{direction} = 'up'); } elsif ($line=~m/^(EXIT):\s+\S+\s+\S+\s+(\S+)\(\)/){ my @stack = $self->{stack}; ($self->{stacktraces}{join('->',@{$self->{stack}})} = \@stack ) && ($self->{direction} = 'down') if( not $self->{direction} eq 'down'); pop(@{$self->{stack}}); } } return ; } 1; package TraceCallStack; use strict; use warnings; use diagnostics; use CallStackAnalyzer; sub Main{ my $trace = open(FH, "CallStack.txt"); my @tracecontent = <FH>; close FH; my $CSA = CallStackAnalyzer->new(); $CSA->TraceFile(\@tracecontent); return; } Main(); 1;
It works out great. I will add one more interface to do the matching against a collection of functions..
Many thanks!!!

Tobias

In reply to Re^2: Analyze a C Call-Stack sequence trace and get call sequence from given Function name onwards. by tobias_hofer
in thread Analyze a C Call-Stack sequence trace and get call sequence from given Function name onwards. by tobias_hofer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.