"Fossies" - the Fresh Open Source Software Archive

Member "FunctionCheck-3.2.0/src/fcmanager/fc_stack.h" (29 May 2012, 2396 Bytes) of package /linux/privat/old/FunctionCheck-3.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * FunctionCheck profiler
    3  * (C) Copyright 2000-2012 Yannick Perret
    4  * 
    5  *  This program is free software; you can redistribute it and/or
    6  *  modify it under the terms of the GNU General Public License as
    7  *  published by the Free Software Foundation; either version 2 of the
    8  *  License, or (at your option) any later version.
    9  *
   10  *  This program is distributed in the hope that it will be useful,
   11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13  *  General Public License for more details.
   14  *
   15  *  You should have received a copy of the GNU General Public License
   16  *  along with this program; if not, write to the Free Software
   17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   18  */
   19 /** fc_stack.h: manage stack operations **/
   20 
   21 #ifndef __fc_stack_h_
   22 #define __fc_stack_h_
   23 
   24 #include <stdio.h>
   25 #include <stdlib.h>
   26 
   27 #include "fc_tools.h"
   28 #include "fc_functions.h"
   29 
   30 /** structures for stack **/
   31 /* element of a stack */
   32 typedef struct
   33 {
   34   FC_Function *function;
   35   void *call_site;
   36   unsigned long long time;
   37 } FC_SElem;
   38 
   39 typedef struct
   40 {
   41   FC_SElem *stack;
   42   unsigned long long *stack_time;
   43   int nb_elements;
   44   int real_size;
   45 } FC_Stack;
   46 
   47 /** functions **/
   48 /* create an epmty stack */
   49 FC_Stack *fc_stack_create(int size);
   50 
   51 /* destroy a stack */
   52 void fc_stack_delete(FC_Stack *stack);
   53 
   54 /* add an element in the stack */
   55 int fc_stack_push(FC_Stack *stack, FC_Function *el, unsigned long long time, void *call_site);
   56 
   57 /* remove the upper element */
   58 int fc_stack_pop(FC_Stack *stack);
   59 
   60 /* get and remove the upper element */
   61 int fc_stack_get_and_pop(FC_Stack *stack, FC_Function **el, unsigned long long *time);
   62 
   63 /* get the upper element */
   64 int fc_stack_get(FC_Stack *stack, FC_Function **el, unsigned long long *time, void **call_site);
   65 
   66 /* get the upper-1 element */
   67 int fc_stack_getp(FC_Stack *stack, FC_Function **el, unsigned long long *time);
   68 
   69 /* get the number of elements in the stack */
   70 int fc_stack_size(FC_Stack *stack);
   71 
   72 /* true if the stack is empty */
   73 int fc_stack_empty(FC_Stack *stack);
   74 
   75 /* true if the element is still present */
   76 int fc_stack_here(FC_Stack *stack, void *el);
   77 
   78 /* set the given void* list (NULL termined) with the current
   79      call-stack (real call-site, not fnc address) */
   80 int fc_get_top_stack(FC_Stack *stack, int nb_max, void **lst);
   81 
   82 #endif /* __fc_stack_h_ */