Changeset 12080
- Timestamp:
- 07/31/09 19:58:50 (14 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/LispThread.java
r12077 r12080 554 554 } 555 555 556 private void doProfiling()557 throws ConditionThrowable558 {559 if (sampleNow)560 Profiler.sample(this);561 }562 563 556 public final void pushStackFrame(LispObject operator) 564 557 throws ConditionThrowable 565 558 { 566 559 stack = new StackFrame(operator, stack); 567 doProfiling();568 560 } 569 561 … … 572 564 { 573 565 stack = new StackFrame(operator, arg, stack); 574 doProfiling();575 566 } 576 567 … … 580 571 { 581 572 stack = new StackFrame(operator, first, second, stack); 582 doProfiling();583 573 } 584 574 … … 588 578 { 589 579 stack = new StackFrame(operator, first, second, third, stack); 590 doProfiling();591 580 } 592 581 … … 595 584 { 596 585 stack = new StackFrame(operator, args, stack); 597 doProfiling();598 586 } 599 587 … … 620 608 } 621 609 finally { 622 doProfiling();623 610 popStackFrame(); 624 611 } … … 637 624 } 638 625 finally { 639 doProfiling();640 626 popStackFrame(); 641 627 } … … 655 641 } 656 642 finally { 657 doProfiling();658 643 popStackFrame(); 659 644 } … … 673 658 } 674 659 finally { 675 doProfiling();676 660 popStackFrame(); 677 661 } … … 692 676 } 693 677 finally { 694 doProfiling();695 678 popStackFrame(); 696 679 } … … 711 694 } 712 695 finally { 713 doProfiling();714 696 popStackFrame(); 715 697 } … … 731 713 } 732 714 finally { 733 doProfiling();734 715 popStackFrame(); 735 716 } … … 754 735 } 755 736 finally { 756 doProfiling();757 737 popStackFrame(); 758 738 } … … 777 757 } 778 758 finally { 779 doProfiling();780 759 popStackFrame(); 781 760 } … … 793 772 } 794 773 finally { 795 doProfiling();796 774 popStackFrame(); 797 775 } -
trunk/abcl/src/org/armedbear/lisp/Profiler.java
r12076 r12080 37 37 { 38 38 private static int sleep = 1; 39 40 public static final void sample(LispThread thread)41 throws ConditionThrowable42 {43 sampleNow = false;44 thread.incrementCallCounts();45 }46 47 private static final Runnable profilerRunnable = new Runnable() {48 public void run()49 {50 profiling = true; // make sure we don't fall through on the first iteration51 while (profiling) {52 sampleNow = true;53 try {54 Thread.sleep(sleep);55 }56 catch (InterruptedException e) {57 Debug.trace(e);58 }59 }60 }61 };62 39 63 40 // ### %start-profiler … … 106 83 if (sampling) { 107 84 sleep = Fixnum.getValue(second); 108 thread.resetStack(); 85 Runnable profilerRunnable = new Runnable() { 86 public void run() 87 { 88 profiling = true; // make sure we don't fall through on the first iteration 89 while (profiling) { 90 try { 91 thread.incrementCallCounts(); 92 Thread.sleep(sleep); 93 } 94 catch (InterruptedException e) { 95 Debug.trace(e); 96 } 97 catch (ConditionThrowable e) { 98 break; 99 } 100 } 101 } 102 }; 109 103 Thread t = new Thread(profilerRunnable); 110 104 // Maximum priority doesn't hurt:
Note: See TracChangeset
for help on using the changeset viewer.