I would like to know how many times I use math (double) functions: add, sub, mul, div inside a complex prog. My first idea was to get the gcc sources and replace the functions in libc library. If I'm not mistaken, this is the double ADD function: DFtype __adddf3(DFtype a, DFtype b) { FP_DECL_EX; FP_DECL_D(A); FP_DECL_D(B); FP_DECL_D(R); DFtype r; FP_INIT_ROUNDMODE; FP_UNPACK_SEMIRAW_D(A, a); FP_UNPACK_SEMIRAW_D(B, b); FP_ADD_D(R, A, B); FP_PACK_SEMIRAW_D(r, R); FP_HANDLE_EXCEPTIONS; return r; } First of all, this one takes more time to execute than the one in libc, which means that the code generated isn't the same. Second, is there a simpler way? Something like: int ADDcount = 0; set alias of "__adddf3" to "myADD" double myADD (double n1, double n2) { ADDcount++; clear alias of "myADD" to original // call original function return (n1 + n2); } set alias of "__adddf3" to "myADD" Thanks
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.