History

Add JS profiling API

Karol Suprynowicz committed 3 years ago

Commit a84c68f1 parent 47ec27f6 files · +144 −2Browse files

Showing the changes to libraries/script-engine/src/ScriptManagerScriptingInterface.h (1 of 6 files). Show all

Unified · Split

libraries/script-engine/src/ScriptManagerScriptingInterface.h+28−1
@@ -529,6 +529,34 @@ public: · 528 unmodified lines
529 */529 */
530 Q_INVOKABLE ScriptValue createGarbageCollectorDebuggingObject();530 Q_INVOKABLE ScriptValue createGarbageCollectorDebuggingObject();
531 531
532 /*@jsdoc
533 * Starts collecting profiling data
534 * @function Script.startProfiling
535 */
536 Q_INVOKABLE void startProfiling();
537
538 /*@jsdoc
539 * Stops collecting profiling data and writes them to a timestamped CSV file in Logs directory.
540 * @function Script.stopProfilingAndSave
541 * @example <caption>Collect profiling data from a script.</caption>
542 * Script.startProfiling();
543 * workFunc1();
544 * Script.stopProfilingAndSave();
545 *
546 * function workFunc1() {
547 * for (var i=0; i<100000; i++) {
548 * var vec1 = {x: i, y: i+1, z: i+2};
549 * var vec2 = {x: i+3, y: i+4, z: i+5};
550 * workFunc2(vec1, vec2);
551 * }
552 * };
553 * function workFunc2(vec1, vec2) {
554 * var cross = Vec3.cross(vec1, vec2);
555 * var dot = Vec3.dot(vec1, vec2);
556 * };
557 */
558 Q_INVOKABLE void stopProfilingAndSave();
559
532signals:560signals:
533 561
534 /*@jsdoc562 /*@jsdoc
@@ -705,7 +733,6 @@ signals: · 170 unmodified lines
705 */733 */
706 void unhandledException(const ScriptValue& exception);734 void unhandledException(const ScriptValue& exception);
707 735
708
709protected:736protected:
710 /*@jsdoc737 /*@jsdoc
711 * @function Script.executeOnScriptThread738 * @function Script.executeOnScriptThread