diff --git a/HISTORY.md b/HISTORY.md
index 42e9287b..c5570ee1 100755
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -7,6 +7,9 @@
* **Notable Fixes:**
* fixed keyboard formula entry for subtraction
+### 2020-12-16
+* threads, objects: added dev debugging hook for counting yields
+
### 2020-12-14
* new dev version
* objects: fixed keyboard formula entry for subtraction
diff --git a/snap.html b/snap.html
index 33f8c41f..f1596b2d 100755
--- a/snap.html
+++ b/snap.html
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/src/objects.js b/src/objects.js
index 92b3efd4..e9188079 100644
--- a/src/objects.js
+++ b/src/objects.js
@@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
-modules.objects = '2020-December-15';
+modules.objects = '2020-December-16';
var SpriteMorph;
var StageMorph;
@@ -928,6 +928,12 @@ SpriteMorph.prototype.initBlocks = function () {
category: 'sensing',
spec: 'frames'
},
+ reportYieldCount: {
+ dev: true,
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'yields'
+ },
reportThreadCount: {
dev: true,
type: 'reporter',
@@ -2552,6 +2558,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
blocks.push(block('reportThreadCount'));
blocks.push(block('reportStackSize'));
blocks.push(block('reportFrameCount'));
+ blocks.push(block('reportYieldCount'));
}
/////////////////////////////////
@@ -8714,6 +8721,7 @@ StageMorph.prototype.blockTemplates = function (category) {
blocks.push(block('reportThreadCount'));
blocks.push(block('reportStackSize'));
blocks.push(block('reportFrameCount'));
+ blocks.push(block('reportYieldCount'));
}
/////////////////////////////////
diff --git a/src/threads.js b/src/threads.js
index 7a425f8a..b85e5d40 100644
--- a/src/threads.js
+++ b/src/threads.js
@@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
-modules.threads = '2020-December-09';
+modules.threads = '2020-December-16';
var ThreadManager;
var Process;
@@ -584,6 +584,7 @@ function Process(topBlock, receiver, onComplete, yieldFirst) {
this.isPaused = false;
this.pauseOffset = null;
this.frameCount = 0;
+ this.yieldCount = 0;
this.exportResult = false;
this.onComplete = onComplete || null;
this.procedureCount = 0;
@@ -642,6 +643,7 @@ Process.prototype.runStep = function (deadline) {
this.evaluateContext();
}
+ this.yieldCount += 1;
this.lastYield = Date.now();
this.isFirstStep = false;
@@ -5925,6 +5927,10 @@ Process.prototype.reportFrameCount = function () {
return this.frameCount;
};
+Process.prototype.reportYieldCount = function () {
+ return this.yieldCount;
+};
+
// Process single-stepping
Process.prototype.flashContext = function () {