Changeset 259
- Timestamp:
- Mar 19, 2004, 9:04:02 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/draft/utils.tex (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/draft/utils.tex
r235 r259 185 185 and \code{free}. 186 186 187 \item 188 The file \file{psMemory.h} shall take steps to ensure that 189 code calling the functions \code{malloc}, \code{calloc}, \code{realloc}, 190 or \code{free} shall not compile (\eg{} \code{#define malloc(S) for}) 191 unless the symbol \code{PS_ALLOC_MALLOC} is defined. 192 187 193 \item 188 194 In all cases, application code will call … … 425 431 that must be collected and saved, even in the production system. 426 432 433 We envision that we will make extensive use of \code{psTrace} throughout 434 the \PS{} code. 435 427 436 \subsection{Tracing APIs} 428 437 \hlabel{psTrace} … … 521 530 For example, after the commands: 522 531 \begin{verbatim} 523 psSetTraceLevel("aaa.bbb.ccc.ddd", 9); 524 psSetTraceLevel("aaa.bbb.ccc", 3); 525 psSetTraceLevel("aaa.bbb.ddd", 4); 526 psSetTraceLevel("aaa.BBB", 2); 527 psSetTraceLevel("BBB", 2); 528 psSetTraceLevel("BBB.XXX.YYY.ZZZ", 5); 529 psSetTraceLevel("aaa.bbb", 2); 530 psSetTraceLevel("aaa.bbb.ccc", 9); 531 psSetTraceLevel("aaa", 1); 532 psSetTraceLevel("utils.dlist.add.head", 9); 533 psSetTraceLevel("utils.dlist.add", 3); 534 psSetTraceLevel("utils.dlist.remove", 4); 535 psSetTraceLevel("coadd", 2); 536 psSetTraceLevel("coadd.CR.remove.morphology", 5); 537 psSetTraceLevel("utils.hash", 2); 538 psSetTraceLevel("utils.dlist.add", 9); 539 psSetTraceLevel("utils", 1); 532 540 \end{verbatim} 533 541 the command \code{psPrintTraceLevels()} should print: 534 542 \begin{verbatim} 535 543 (root) 0 536 aaa 1 537 bbb 2 538 ccc 9 539 ddd 9 540 ddd 4 541 BBB 2 542 BBB 2 543 XXX . 544 YYY . 545 ZZZ 5 546 \end{verbatim} 544 utils 1 545 hash 2 546 dlist . 547 remove 4 548 add 9 549 head 9 550 coadd 2 551 CR . 552 remove . 553 morphology 5 554 \end{verbatim} 555 where \code{.} means that the trace level should be inherited from its parent. 547 556 548 557 After this set of \code{psSetTraceLevel} commands, and if 549 558 \code{PS_NTRACE} is not defined, the following commands 550 559 \begin{verbatim} 551 psTrace("aaa.bbb.ddd", 2, "(aaa.bbb.ddd) Hello %s\n", "world"); 552 psTrace("aaa", 2, "aaa\n"); 553 psTrace("", 2, "\"\"\n"); 554 psTrace("aaa.bbb", 2, "aaa.bbb\n"); 555 psTrace("aaa.bbb.ddd", 2, "aaa.bbb.ddd\n"); 556 psTrace("aaa.bbb.ddd", 4, "aaa.bbb.ddd\n"); 557 psTrace("aaa.bbb.ddd", 2, "aaa.bbb.ddd\n"); 558 psTrace("aaa.bbb.ccc", 1, "aaa.bbb.ccc\n"); 559 psTrace("aaa.bbb.eee", 2, "aaa.bbb.eee\n"); 560 psTrace("utils.dlist.remove", 2, "Removing psDList key \"%s\"\n", "my_key"); 561 psTrace("utils", 2, "Initialising utilities library\n"); 562 psTrace("", 2, "This is turned on by trace component \"\""); 563 psTrace("utils.dlist", 2, "Initialising psDList\n"); 564 psTrace("utils.dlist.remove", 4, "Removing psDList key \"%s\" (value: \"%d\")\n", "my_key", 12345); 565 psTrace("utils.hash.remove", 4, "Removing hash key \"%s\" (value: \"%d\")\n", "my_key", 12345); 566 psTrace("utils.dlist.add", 1, "Adding psDList key \"%s\"\n", "your_key"); 567 psTrace("utils.dlist.find", 2, "Looking up psDList key \"%s\"\n", "some_key"); 568 psTrace("coadd.CR.remove", 4, "Removing CRs\n"); 569 psTrace("coadd.CR.remove.morphology", 4, "CRs are not fuzzy\n"); 560 570 \end{verbatim} 561 571 should produce this output: 562 572 \begin{verbatim} 563 (aaa.bbb.ddd) Hello world 564 aaa.bbb 565 aaa.bbb.ddd 566 aaa.bbb.ddd 567 aaa.bbb.ddd 568 aaa.bbb.ccc 569 aaa.bbb.eee 570 \end{verbatim} 573 Removing psDList key "my_key" 574 Removing psDList key "my_key" (value: "12345") 575 Adding psDList key "your_key" 576 CRs are not fuzzy 577 \end{verbatim} 578 579 Note that 580 \begin{description} 581 \item 582 \code{utils.dlist} messages are at level 1, inherited from \code{utils}, so the 583 \code{Initialising utilities library}, \code{Initialising psDList}, and 584 \code{Looking up psDList key} messages are \emph{not} printed (the traces are at level 2). 585 586 \item 587 \code{utils.dlist.remove} messages are at level 4, and are printed. 588 589 \item 590 \code{utils.hash} messages are at level 2, and are not printed (the traces are at level 4) 591 592 \item 593 \code{coadd.CR.remove} is at level 2 (inherited from \code{coadd}) so \code{Removing CRs} 594 isn't printed. \code{coadd.CR.remove.morphology} is at level 4, so \code{CRs are not fuzzy} is printed. 595 \end{description} 571 596 572 597 \subsection{Message Logging}
Note:
See TracChangeset
for help on using the changeset viewer.
