diff --git a/common/utils/T/T.h b/common/utils/T/T.h index 4f5ef046fe..6d781241a5 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -96,10 +96,12 @@ struct T_header; /* T macro tricks */ extern int T_stdout; -#define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\ - 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__) -#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\ - n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n +#define TN(...) TN_N(__VA_ARGS__,39,38,37,36,35,34,33,32,31,30,29,28,27,26, \ + 25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, \ + 6,5,4,3,2,1,0)(__VA_ARGS__) +#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17, \ + n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32, \ + n33,n34,n35,n36,n37,n38,n,...) T##n #define T(...) do { if (T_stdout == 0 || T_stdout == 2) TN(__VA_ARGS__); } while (0) /* type used to send arbitrary buffer data */ @@ -370,7 +372,8 @@ extern int *T_active; } \ } while (0) -#define T23(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9,t10,x10) \ +#define T23(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10) \ do { \ if (T_ACTIVE(t)) { \ T_LOCAL_DATA \ @@ -390,7 +393,8 @@ extern int *T_active; } \ } while (0) -#define T25(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9,t10,x10,t11,x11) \ +#define T25(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11) \ do { \ if (T_ACTIVE(t)) { \ T_LOCAL_DATA \ @@ -411,7 +415,8 @@ extern int *T_active; } \ } while (0) -#define T27(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9,t10,x10,t11,x11,t12,x12) \ +#define T27(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11,t12,x12) \ do { \ if (T_ACTIVE(t)) { \ T_LOCAL_DATA \ @@ -433,7 +438,8 @@ extern int *T_active; } \ } while (0) -#define T29(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9,t10,x10,t11,x11,t12,x12,t13,x13) \ +#define T29(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11,t12,x12,t13,x13) \ do { \ if (T_ACTIVE(t)) { \ T_LOCAL_DATA \ @@ -456,7 +462,8 @@ extern int *T_active; } \ } while (0) -#define T31(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9,t10,x10,t11,x11,t12,x12,t13,x13,t14,x14) \ +#define T31(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11,t12,x12,t13,x13,t14,x14) \ do { \ if (T_ACTIVE(t)) { \ T_LOCAL_DATA \ @@ -480,7 +487,8 @@ extern int *T_active; } \ } while (0) -#define T33(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9,t10,x10,t11,x11,t12,x12,t13,x13,t14,x14,t15,x15) \ +#define T33(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11,t12,x12,t13,x13,t14,x14,t15,x15) \ do { \ if (T_ACTIVE(t)) { \ T_LOCAL_DATA \ @@ -505,6 +513,91 @@ extern int *T_active; } \ } while (0) +#define T35(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11,t12,x12,t13,x13,t14,x14,t15,x15,t16,x16) \ + do { \ + if (T_ACTIVE(t)) { \ + T_LOCAL_DATA \ + T_HEADER(t); \ + T_PUT_##t0(2, x0); \ + T_PUT_##t1(3, x1); \ + T_PUT_##t2(4, x2); \ + T_PUT_##t3(5, x3); \ + T_PUT_##t4(6, x4); \ + T_PUT_##t5(7, x5); \ + T_PUT_##t6(8, x6); \ + T_PUT_##t7(9, x7); \ + T_PUT_##t8(10, x8); \ + T_PUT_##t9(11, x9); \ + T_PUT_##t10(12, x10); \ + T_PUT_##t11(13, x11); \ + T_PUT_##t12(14, x12); \ + T_PUT_##t13(15, x13); \ + T_PUT_##t14(16, x14); \ + T_PUT_##t15(17, x15); \ + T_PUT_##t16(18, x16); \ + T_COMMIT(); \ + } \ + } while (0) + +#define T37(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11,t12,x12,t13,x13,t14,x14,t15,x15,t16,x16,t17,x17) \ + do { \ + if (T_ACTIVE(t)) { \ + T_LOCAL_DATA \ + T_HEADER(t); \ + T_PUT_##t0(2, x0); \ + T_PUT_##t1(3, x1); \ + T_PUT_##t2(4, x2); \ + T_PUT_##t3(5, x3); \ + T_PUT_##t4(6, x4); \ + T_PUT_##t5(7, x5); \ + T_PUT_##t6(8, x6); \ + T_PUT_##t7(9, x7); \ + T_PUT_##t8(10, x8); \ + T_PUT_##t9(11, x9); \ + T_PUT_##t10(12, x10); \ + T_PUT_##t11(13, x11); \ + T_PUT_##t12(14, x12); \ + T_PUT_##t13(15, x13); \ + T_PUT_##t14(16, x14); \ + T_PUT_##t15(17, x15); \ + T_PUT_##t16(18, x16); \ + T_PUT_##t17(19, x17); \ + T_COMMIT(); \ + } \ + } while (0) + +#define T39(t,t0,x0,t1,x1,t2,x2,t3,x3,t4,x4,t5,x5,t6,x6,t7,x7,t8,x8,t9,x9, \ + t10,x10,t11,x11,t12,x12,t13,x13,t14,x14,t15,x15,t16,x16,t17,x17, \ + t18,x18) \ + do { \ + if (T_ACTIVE(t)) { \ + T_LOCAL_DATA \ + T_HEADER(t); \ + T_PUT_##t0(2, x0); \ + T_PUT_##t1(3, x1); \ + T_PUT_##t2(4, x2); \ + T_PUT_##t3(5, x3); \ + T_PUT_##t4(6, x4); \ + T_PUT_##t5(7, x5); \ + T_PUT_##t6(8, x6); \ + T_PUT_##t7(9, x7); \ + T_PUT_##t8(10, x8); \ + T_PUT_##t9(11, x9); \ + T_PUT_##t10(12, x10); \ + T_PUT_##t11(13, x11); \ + T_PUT_##t12(14, x12); \ + T_PUT_##t13(15, x13); \ + T_PUT_##t14(16, x14); \ + T_PUT_##t15(17, x15); \ + T_PUT_##t16(18, x16); \ + T_PUT_##t17(19, x17); \ + T_PUT_##t18(20, x18); \ + T_COMMIT(); \ + } \ + } while (0) + #define T_CALL_ERROR \ do { \ printf("%s:%d:%s: error calling T, you have to use T_INT() or T_XX()\n", \ @@ -527,6 +620,9 @@ extern int *T_active; #define T28(...) T_CALL_ERROR #define T30(...) T_CALL_ERROR #define T32(...) T_CALL_ERROR +#define T34(...) T_CALL_ERROR +#define T36(...) T_CALL_ERROR +#define T38(...) T_CALL_ERROR /* special cases for VCD logs */ diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h index 00e0df4963..13b664a487 100644 --- a/common/utils/T/T_defs.h +++ b/common/utils/T/T_defs.h @@ -36,9 +36,6 @@ /* comment (and recompile everything) to not send time in events */ #define T_SEND_TIME -/* maximum number of arguments for the T macro */ -#define T_MAX_ARGS 16 - /* maximum size of a message - increase if needed */ #define T_BUFFER_MAX (1024*64*4) diff --git a/common/utils/T/tracer/event.c b/common/utils/T/tracer/event.c index a5d04166d4..f75af1e398 100644 --- a/common/utils/T/tracer/event.c +++ b/common/utils/T/tracer/event.c @@ -71,6 +71,12 @@ event new_event(int type, int length, char *buffer, void *database) e.buffer = buffer; f = get_format(database, type); + if (f.count > T_MAX_ARGS) { + printf("fatal: the T trace %s is defined to take %d arguments, but T_MAX_ARGS is %d. " + "Increase T_MAX_ARGS in event.h and recompile all the tracers (make clean; make).\n", + event_name_from_id(database, type), f.count, T_MAX_ARGS); + exit(1); + } e.ecount = f.count; diff --git a/common/utils/T/tracer/event.h b/common/utils/T/tracer/event.h index 0170ab6680..4e631fbb49 100644 --- a/common/utils/T/tracer/event.h +++ b/common/utils/T/tracer/event.h @@ -7,6 +7,9 @@ #include #endif +/* maximum number of arguments for the T macro */ +#define T_MAX_ARGS 32 + enum event_arg_type { EVENT_INT, EVENT_ULONG,