| |
434 |
434 |
oldProfileState = rst->doTrace; |
| |
435 |
435 |
rst->doTrace = withEnable; |
| |
436 |
436 |
|
| |
437 |
437 |
|
| |
438 |
438 |
|
| |
439 |
439 |
|
| |
440 |
440 |
if (withEnable == 1) { |
| |
441 |
441 |
if (rst->doProfile == 1) { |
| |
442 |
442 |
NsfLog(interp, NSF_LOG_WARN, "nsfprofile: tracing is already active"); |
| |
443 |
443 |
} else { |
| |
444 |
444 |
|
| |
445 |
445 |
|
| |
446 |
446 |
|
| |
447 |
447 |
if (builtinObjs != NULL) { |
| |
448 |
448 |
|
| |
449 |
449 |
|
| |
450 |
450 |
|
| |
451 |
451 |
if (Tcl_ListObjGetElements(interp, builtinObjs, &oc, &ov) != TCL_OK) { |
| |
452 |
452 |
NsfLog(interp, NSF_LOG_WARN, "nsfprofile: argument '%s' is not a list of commands", ObjStr(builtinObjs)); |
| |
453 |
453 |
} else { |
| |
454 |
|
NsfShadowTclCommandInfo *ti = NEW_ARRAY(NsfShadowTclCommandInfo, oc); |
| |
455 |
454 |
int i; |
| |
|
455 |
NsfShadowTclCommandInfo *ti = NEW_ARRAY(NsfShadowTclCommandInfo, oc); |
| |
456 |
456 |
|
| |
457 |
457 |
for (i = 0; i < oc; i++) { |
| |
458 |
458 |
int nrArgs = 0; |
| |
459 |
459 |
Tcl_Obj *nameObj = NULL; |
| |
460 |
460 |
|
| |
461 |
461 |
if (GetPair(interp, ov[i], 1, &nameObj, &nrArgs) == TCL_OK) { |
| |
462 |
462 |
assert(nameObj != NULL); |
| |
463 |
463 |
ti[i].nrArgs = nrArgs; |
| |
464 |
464 |
|
| |
465 |
465 |
if (NsfReplaceCommand(interp, nameObj, Nsf_ProfileFilterObjCmd, &ti[i], &ti[i]) != TCL_OK) { |
| |
466 |
466 |
NsfLog(interp, NSF_LOG_WARN, "nsfprofile: list element '%s' is not a command", ObjStr(nameObj)); |
| |
467 |
467 |
} |
| |
468 |
468 |
} |
| |
469 |
469 |
} |
| |
470 |
470 |
INCR_REF_COUNT(builtinObjs); |
| |
471 |
471 |
profilePtr->shadowedObjs = builtinObjs; |
| |
472 |
472 |
profilePtr->shadowedTi = ti; |
| |
473 |
473 |
} |
| |
474 |
474 |
} |
| |
475 |
475 |
} |