Check-in [eec9d69bc1]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:simplification of check-in [c29648d90f]
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: eec9d69bc196db31f40c567c77d899d89284e832
User & Date: chw 2016-11-21 19:27:15
Context
2016-11-25
13:50
further improvements of tclx's profile command check-in: c6070d8891 user: chw tags: trunk
2016-11-21
19:27
simplification of check-in [c29648d90f] check-in: eec9d69bc1 user: chw tags: trunk
14:36
add missing files to vu widgets directory check-in: 26fbc863bd user: chw tags: trunk
Changes

Changes to jni/tclx/generic/tclXprofile.c.

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
...
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
...
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
....
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
    int             commandMode;           /* Prof all commands?             */
    int             evalMode;              /* Use eval stack.                */
    Command        *currentCmdPtr;         /* Current command table entry.   */
    Tcl_CmdProc    *savedStrCmdProc;       /* Saved string command function  */
    ClientData      savedStrCmdClientData; /* and clientData.                */
    Tcl_ObjCmdProc *savedObjCmdProc;       /* Saved object command function  */
#ifdef OBJ_AND_NRE
    Tcl_ObjCmdProc *savedNreProc;
#endif
    ClientData      savedObjCmdClientData; /* and clientData.                */
#ifdef OBJ_AND_NRE
    Tcl_CmdDeleteProc *savedDeleteProc;
    ClientData         savedDeleteData;
#endif
    int             evalLevel;             /* Eval level when invoked.       */
    clock_t         realTime;              /* Current real and CPU time.     */
    clock_t         cpuTime;
    clock_t         prevRealTime;          /* Real and CPU time of previous  */
    clock_t         prevCpuTime;           /* trace.                         */
    int             updatedTimes;          /* Has current times been updated?*/
    profEntry_t    *stackPtr;              /* Proc/command nesting stack.    */
................................................................................
#ifdef OBJ_AND_NRE
static int
ProfNreCommandEval _ANSI_ARGS_((ClientData    clientData,
                                Tcl_Interp   *interp,
                                int           objc,
                                Tcl_Obj      *CONST objv[]));

static void
ProfCommandDelete _ANSI_ARGS_((ClientData   clientData));
#endif

#ifdef OBJ_AND_NRE
static int
ProfObjTraceRoutine _ANSI_ARGS_((ClientData     clientData,
                                 Tcl_Interp    *interp,
                                 int            evalLevel,
                                 const char    *command,
                                 Tcl_Command    cmd,
                                 int            objc,
................................................................................
        currentCmdPtr->objProc = infoPtr->savedObjCmdProc;
#ifdef OBJ_AND_NRE
    if (currentCmdPtr->nreProc == ProfNreCommandEval)
        currentCmdPtr->nreProc = infoPtr->savedNreProc;
#endif
    if (currentCmdPtr->objClientData == (ClientData) infoPtr)
        currentCmdPtr->objClientData = infoPtr->savedObjCmdClientData;
#ifdef OBJ_AND_NRE
    if (currentCmdPtr->deleteProc == ProfCommandDelete) {
        currentCmdPtr->deleteProc = infoPtr->savedDeleteProc;
        currentCmdPtr->deleteData = infoPtr->savedDeleteData;
    }
#endif
    infoPtr->currentCmdPtr = NULL;
    infoPtr->savedStrCmdProc = NULL;
    infoPtr->savedStrCmdClientData = NULL;
    infoPtr->savedObjCmdProc = NULL;
#ifdef OBJ_AND_NRE
    infoPtr->savedNreProc = NULL;
#endif
    infoPtr->savedObjCmdClientData = NULL;
#ifdef OBJ_AND_NRE
    infoPtr->savedDeleteProc = NULL;
    infoPtr->savedDeleteData = NULL;
#endif

    fullCmdNamePtr = Tcl_NewObj ();
    Tcl_GetCommandFullName (infoPtr->interp, (Tcl_Command) currentCmdPtr, 
                            fullCmdNamePtr);
    fullCmdName = Tcl_GetStringFromObj (fullCmdNamePtr, NULL);

    /*
................................................................................

    result = (*currentCmdPtr->nreProc) (currentCmdPtr->objClientData, interp,
                                        objc, objv);

    ProfCommandEvalFinishup (infoPtr, isProc);
    return result;
}
 
/*-----------------------------------------------------------------------------
 * ProfCommandDelete --
 *   Function to handle command deletion. PANIC for now.
 *-----------------------------------------------------------------------------
 */
static void
ProfCommandDelete (clientData)
    ClientData    clientData;
{
    panic (PROF_PANIC, 7);
}
 
/*-----------------------------------------------------------------------------
  * ProfObjTraceRoutine --
 *   Routine called by Tcl_Eval to do profiling.  It intercepts the current
 * command being executed by temporarily editing the command table.
 *-----------------------------------------------------------------------------
 */
................................................................................
     */
    infoPtr->currentCmdPtr = cmdPtr;
    infoPtr->savedStrCmdProc = cmdPtr->proc;
    infoPtr->savedStrCmdClientData = cmdPtr->clientData;
    infoPtr->savedObjCmdProc = cmdPtr->objProc;
    infoPtr->savedNreProc = cmdPtr->nreProc;
    infoPtr->savedObjCmdClientData = cmdPtr->objClientData;
    infoPtr->savedDeleteProc = cmdPtr->deleteProc;
    infoPtr->savedDeleteData = cmdPtr->deleteData;
    infoPtr->evalLevel = evalLevel;

    /*
     * Force our routines to be called.
     */
    cmdPtr->proc = ProfStrCommandEval;
    cmdPtr->clientData = (ClientData) infoPtr;
    cmdPtr->objProc = ProfObjCommandEval;
    if (cmdPtr->nreProc != NULL) {
        cmdPtr->nreProc = ProfNreCommandEval;
    }
    cmdPtr->objClientData = (ClientData) infoPtr;
    cmdPtr->deleteProc = ProfCommandDelete;
    cmdPtr->deleteData = (ClientData) infoPtr;
    return TCL_OK;
}
#else
 
/*-----------------------------------------------------------------------------
  * ProfTraceRoutine --
 *   Routine called by Tcl_Eval to do profiling.  It intercepts the current
................................................................................
    infoPtr->savedStrCmdProc = NULL;
    infoPtr->savedStrCmdClientData = NULL;
    infoPtr->savedObjCmdProc = NULL;
#ifdef OBJ_AND_NRE
    infoPtr->savedNreProc = NULL;
#endif
    infoPtr->savedObjCmdClientData = NULL;
#ifdef OBJ_AND_NRE
    infoPtr->savedDeleteProc = NULL;
    infoPtr->savedDeleteData = NULL;
#endif
    infoPtr->evalLevel = UNKNOWN_LEVEL;
    infoPtr->realTime = 0;
    infoPtr->cpuTime = 0;
    infoPtr->prevRealTime = 0;
    infoPtr->prevCpuTime = 0;
    infoPtr->updatedTimes = FALSE;
    infoPtr->stackPtr = NULL;







|


<
<
<
<







 







<
<
<
<
<







 







<
<
<
<
<
<








<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<







 







<
<












<
<







 







<
<
<
<







76
77
78
79
80
81
82
83
84
85




86
87
88
89
90
91
92
...
145
146
147
148
149
150
151





152
153
154
155
156
157
158
...
447
448
449
450
451
452
453






454
455
456
457
458
459
460
461




462
463
464
465
466
467
468
...
635
636
637
638
639
640
641












642
643
644
645
646
647
648
...
676
677
678
679
680
681
682


683
684
685
686
687
688
689
690
691
692
693
694


695
696
697
698
699
700
701
....
1111
1112
1113
1114
1115
1116
1117




1118
1119
1120
1121
1122
1123
1124
    int             commandMode;           /* Prof all commands?             */
    int             evalMode;              /* Use eval stack.                */
    Command        *currentCmdPtr;         /* Current command table entry.   */
    Tcl_CmdProc    *savedStrCmdProc;       /* Saved string command function  */
    ClientData      savedStrCmdClientData; /* and clientData.                */
    Tcl_ObjCmdProc *savedObjCmdProc;       /* Saved object command function  */
#ifdef OBJ_AND_NRE
    Tcl_ObjCmdProc *savedNreProc;          /* and NRE function               */
#endif
    ClientData      savedObjCmdClientData; /* and clientData.                */




    int             evalLevel;             /* Eval level when invoked.       */
    clock_t         realTime;              /* Current real and CPU time.     */
    clock_t         cpuTime;
    clock_t         prevRealTime;          /* Real and CPU time of previous  */
    clock_t         prevCpuTime;           /* trace.                         */
    int             updatedTimes;          /* Has current times been updated?*/
    profEntry_t    *stackPtr;              /* Proc/command nesting stack.    */
................................................................................
#ifdef OBJ_AND_NRE
static int
ProfNreCommandEval _ANSI_ARGS_((ClientData    clientData,
                                Tcl_Interp   *interp,
                                int           objc,
                                Tcl_Obj      *CONST objv[]));






static int
ProfObjTraceRoutine _ANSI_ARGS_((ClientData     clientData,
                                 Tcl_Interp    *interp,
                                 int            evalLevel,
                                 const char    *command,
                                 Tcl_Command    cmd,
                                 int            objc,
................................................................................
        currentCmdPtr->objProc = infoPtr->savedObjCmdProc;
#ifdef OBJ_AND_NRE
    if (currentCmdPtr->nreProc == ProfNreCommandEval)
        currentCmdPtr->nreProc = infoPtr->savedNreProc;
#endif
    if (currentCmdPtr->objClientData == (ClientData) infoPtr)
        currentCmdPtr->objClientData = infoPtr->savedObjCmdClientData;






    infoPtr->currentCmdPtr = NULL;
    infoPtr->savedStrCmdProc = NULL;
    infoPtr->savedStrCmdClientData = NULL;
    infoPtr->savedObjCmdProc = NULL;
#ifdef OBJ_AND_NRE
    infoPtr->savedNreProc = NULL;
#endif
    infoPtr->savedObjCmdClientData = NULL;





    fullCmdNamePtr = Tcl_NewObj ();
    Tcl_GetCommandFullName (infoPtr->interp, (Tcl_Command) currentCmdPtr, 
                            fullCmdNamePtr);
    fullCmdName = Tcl_GetStringFromObj (fullCmdNamePtr, NULL);

    /*
................................................................................

    result = (*currentCmdPtr->nreProc) (currentCmdPtr->objClientData, interp,
                                        objc, objv);

    ProfCommandEvalFinishup (infoPtr, isProc);
    return result;
}












 
/*-----------------------------------------------------------------------------
  * ProfObjTraceRoutine --
 *   Routine called by Tcl_Eval to do profiling.  It intercepts the current
 * command being executed by temporarily editing the command table.
 *-----------------------------------------------------------------------------
 */
................................................................................
     */
    infoPtr->currentCmdPtr = cmdPtr;
    infoPtr->savedStrCmdProc = cmdPtr->proc;
    infoPtr->savedStrCmdClientData = cmdPtr->clientData;
    infoPtr->savedObjCmdProc = cmdPtr->objProc;
    infoPtr->savedNreProc = cmdPtr->nreProc;
    infoPtr->savedObjCmdClientData = cmdPtr->objClientData;


    infoPtr->evalLevel = evalLevel;

    /*
     * Force our routines to be called.
     */
    cmdPtr->proc = ProfStrCommandEval;
    cmdPtr->clientData = (ClientData) infoPtr;
    cmdPtr->objProc = ProfObjCommandEval;
    if (cmdPtr->nreProc != NULL) {
        cmdPtr->nreProc = ProfNreCommandEval;
    }
    cmdPtr->objClientData = (ClientData) infoPtr;


    return TCL_OK;
}
#else
 
/*-----------------------------------------------------------------------------
  * ProfTraceRoutine --
 *   Routine called by Tcl_Eval to do profiling.  It intercepts the current
................................................................................
    infoPtr->savedStrCmdProc = NULL;
    infoPtr->savedStrCmdClientData = NULL;
    infoPtr->savedObjCmdProc = NULL;
#ifdef OBJ_AND_NRE
    infoPtr->savedNreProc = NULL;
#endif
    infoPtr->savedObjCmdClientData = NULL;




    infoPtr->evalLevel = UNKNOWN_LEVEL;
    infoPtr->realTime = 0;
    infoPtr->cpuTime = 0;
    infoPtr->prevRealTime = 0;
    infoPtr->prevCpuTime = 0;
    infoPtr->updatedTimes = FALSE;
    infoPtr->stackPtr = NULL;