LCOV - code coverage report
Current view: top level - monetdb5/optimizer - opt_profiler.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 39 15.4 %
Date: 2021-10-13 02:24:04 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : /*
      10             :  * Collect properties for beautified variable rendering
      11             :  * All variables are tagged with the schema.table.column name if possible.
      12             :  */
      13             : 
      14             : #include "monetdb_config.h"
      15             : #include "mal_instruction.h"
      16             : #include "mal_profiler.h"
      17             : #include "opt_prelude.h"
      18             : #include "opt_profiler.h"
      19             : 
      20             : str
      21      356704 : OPTprofilerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
      22             : {
      23             :         int i, actions = 0;
      24             :         InstrPtr p;
      25             :         str msg = MAL_SUCCEED;
      26             : 
      27             :         (void) stk;
      28             :         (void) cntxt;
      29             :         /* we only need the beautified version if we plan to emit events */
      30      356704 :         if(malProfileMode == 0 )
      31      356704 :                 goto wrapup;
      32             : 
      33           0 :         for( i=0; i< mb->stop; i++){
      34           0 :                 p= getInstrPtr(mb,i);
      35           0 :                 if( p == NULL)
      36           0 :                         continue;
      37           0 :                 if ( getModuleId(p) == NULL || getFunctionId(p) == NULL)
      38           0 :                         continue;
      39           0 :                 if( getModuleId(p)== sqlRef && (getFunctionId(p)== bindRef || getFunctionId(p) == bindidxRef)){
      40           0 :                         getVarSTC(mb,getArg(p,0)) = i;
      41             :                 } else
      42           0 :                 if( getModuleId(p)== sqlRef && getFunctionId(p)== tidRef){
      43           0 :                         getVarSTC(mb,getArg(p,0)) = i;
      44             :                 } else
      45           0 :                 if( getModuleId(p)== sqlRef && (getFunctionId(p)== deltaRef || getFunctionId(p) == subdeltaRef)){
      46             :                         // inherit property of first argument
      47           0 :                         getVarSTC(mb,getArg(p,0)) = getVarSTC(mb,getArg(p,1));
      48             :                 } else
      49           0 :                 if( getModuleId(p)== sqlRef && getFunctionId(p)== projectdeltaRef){
      50           0 :                         getVarSTC(mb,getArg(p,0)) = getVarSTC(mb,getArg(p,1));
      51             :                 } else
      52           0 :                 if( getModuleId(p)== algebraRef && getFunctionId(p)== projectionRef){
      53           0 :                         getVarSTC(mb,getArg(p,0)) = getVarSTC(mb,getArg(p,p->argc-1));
      54             :                 } else
      55           0 :                 if( getModuleId(p)== algebraRef &&
      56           0 :                         (getFunctionId(p)== selectRef ||
      57           0 :                          getFunctionId(p) == thetaselectRef ||
      58           0 :                          getFunctionId(p) == selectNotNilRef) ){
      59           0 :                         getVarSTC(mb,getArg(p,0)) = getVarSTC(mb,getArg(p,p->retc));
      60             :                 } else
      61           0 :                 if( getModuleId(p)== algebraRef && getFunctionId(p)== likeselectRef){
      62           0 :                         getVarSTC(mb,getArg(p,0)) = getVarSTC(mb,getArg(p,p->retc));
      63             :                 } else
      64           0 :                 if( getModuleId(p)== algebraRef &&
      65           0 :                         ( getFunctionId(p)== joinRef ||
      66           0 :                           getFunctionId(p) == leftjoinRef ||
      67           0 :                           getFunctionId(p) == thetajoinRef ||
      68           0 :                           getFunctionId(p) == bandjoinRef ||
      69           0 :                           getFunctionId(p) == rangejoinRef )){
      70           0 :                                 getVarSTC(mb,getArg(p,0)) = getVarSTC(mb,getArg(p,p->retc));
      71           0 :                                 getVarSTC(mb,getArg(p,1)) = getVarSTC(mb,getArg(p,p->retc +1));
      72             :                 } else
      73           0 :                 if( getModuleId(p)== matRef && getFunctionId(p)== packIncrementRef){
      74           0 :                         getVarSTC(mb,getArg(p,0)) = getVarSTC(mb,getArg(p,1));
      75             :                 }
      76             :         }
      77             :         actions = 1;
      78             :         /* Defense line against incorrect plans */
      79             :         /* Plan remains unaffected */
      80             :         // msg = chkTypes(cntxt->usermodule, mb, FALSE);
      81             :         // if (!msg)
      82             :         //      msg = chkFlow(mb);
      83             :         // if (!msg)
      84             :         //      msg = chkDeclarations(mb);
      85      356704 : wrapup:
      86             :         /* keep actions taken as a fake argument*/
      87      356704 :         (void) pushInt(mb, pci, actions);
      88      356704 :         return msg;
      89             : }

Generated by: LCOV version 1.14