1 //------------------------------------------------------------------------------ 2 // GB_mex_debug: determine GB_DEBUG status 3 //------------------------------------------------------------------------------ 4 5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 6 // SPDX-License-Identifier: Apache-2.0 7 8 //------------------------------------------------------------------------------ 9 10 #include "GB_mex.h" 11 12 #define USAGE "[debug compact malloc cover] = GB_mex_debug" 13 mexFunction(int nargout,mxArray * pargout[],int nargin,const mxArray * pargin[])14void mexFunction 15 ( 16 int nargout, 17 mxArray *pargout [ ], 18 int nargin, 19 const mxArray *pargin [ ] 20 ) 21 { 22 bool malloc_debug = GB_mx_get_global (false) ; 23 24 // check inputs 25 if (nargout > 4 || nargin != 0) 26 { 27 mexErrMsgTxt ("Usage: " USAGE) ; 28 } 29 30 bool pr = (nargout == 0) ; 31 32 if (pr) 33 { 34 printf ("\n-------------------------------------------------------\n") ; 35 printf ("GraphBLAS compilation and run-time options:\n") ; 36 } 37 38 #ifdef GB_DEBUG 39 if (pr) printf ("GB_DEBUG: debugging enabled:" 40 " GraphBLAS will be slow\n") ; 41 pargout [0] = mxCreateDoubleScalar (1) ; 42 #else 43 if (pr) printf ("GB_DEBUG: normal: debugging not enabled\n") ; 44 pargout [0] = mxCreateDoubleScalar (0) ; 45 #endif 46 47 #ifdef GBCOMPACT 48 if (pr) printf ("GBCOMPACT: enabled: fast compile but slow C=A*B\n") ; 49 pargout [1] = mxCreateDoubleScalar (1) ; 50 #else 51 if (pr) printf ("GBCOMPACT: normal: slow compile but fast C=A*B\n") ; 52 pargout [1] = mxCreateDoubleScalar (0) ; 53 #endif 54 55 if (malloc_debug) 56 { 57 if (pr) printf ("malloc debug: enabled: malloc testing\n") ; 58 pargout [2] = mxCreateDoubleScalar (1) ; 59 } 60 else 61 { 62 if (pr) printf ("malloc debug: normal: no malloc testing\n") ; 63 pargout [2] = mxCreateDoubleScalar (0) ; 64 } 65 66 #ifdef GBCOVER 67 if (pr) printf ("GBCOVER: enabled: test coverage\n") ; 68 pargout [3] = mxCreateDoubleScalar (1) ; 69 #else 70 if (pr) printf ("GBCOVER: normal: no statement coverage\n") ; 71 pargout [3] = mxCreateDoubleScalar (0) ; 72 #endif 73 74 if (pr) 75 { 76 printf ("-------------------------------------------------------\n\n") ; 77 } 78 79 GB_mx_put_global (false) ; 80 } 81 82