001package Torello.Browser.JavaScriptAPI; 002 003// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 004// Java-HTML Imports 005// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 006 007import Torello.Browser.*; 008import Torello.Browser.helper.*; 009import Torello.Browser.BrowserAPI.*; 010import Torello.JSON.*; 011 012import Torello.Java.ReadOnly.ReadOnlyList; 013import Torello.Java.ReadOnly.ReadOnlyArrayList; 014 015import Torello.JavaDoc.Annotations.StaticFunctional; 016import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg; 017 018import Torello.Browser.JavaScriptAPI.NestedHelpers.Commands.Profiler$$Commands; 019 020 021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 022// JDK Imports 023// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 024 025import javax.json.JsonObject; 026import javax.json.JsonValue; 027 028/** 029 * <SPAN CLASS=COPIEDJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN> 030 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE> 031 */ 032@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE") 033public class Profiler 034{ 035 // No Pubic Constructors 036 private Profiler() { } 037 038 039 040 // ******************************************************************************************** 041 // ******************************************************************************************** 042 // Basic Types 043 // ******************************************************************************************** 044 // ******************************************************************************************** 045 046 047 /** 048 * Coverage data for a source range. 049 * 050 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 051 */ 052 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 053 public static class CoverageRange 054 extends BaseType<CoverageRange> 055 implements java.io.Serializable 056 { 057 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 058 protected static final long serialVersionUID = 1; 059 060 private static final NestedHelper<Profiler.CoverageRange> singleton = 061 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 062 Profiler$$CoverageRange$$.singleton; 063 064 /** JavaScript script source offset for the range start. */ 065 public final int startOffset; 066 067 /** JavaScript script source offset for the range end. */ 068 public final int endOffset; 069 070 /** Collected execution count of the source range. */ 071 public final int count; 072 073 /** Constructor. Please review this class' fields for documentation. */ 074 public CoverageRange 075 (ReadOnlyList<Boolean> isPresent, int startOffset, int endOffset, int count) 076 { 077 super(singleton, Domains.Profiler, "CoverageRange", 3); 078 079 this.startOffset = startOffset; 080 this.endOffset = endOffset; 081 this.count = count; 082 083 this.isPresent = (isPresent == null) 084 ? singleton.generateIsPresentList(this) 085 : THROWS.check(isPresent, 3, "Profiler.CoverageRange"); 086 } 087 088 /** Creates an instance of this class from a {@link JsonObject}.*/ 089 public static CoverageRange fromJSON(JsonObject jo) 090 { return singleton.fromJSON(jo); } 091 092 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 093 public static NestedDescriptor<CoverageRange> descriptor() 094 { return singleton.descriptor(); } 095 } 096 097 /** 098 * Coverage data for a JavaScript function. 099 * 100 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 101 */ 102 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 103 public static class FunctionCoverage 104 extends BaseType<FunctionCoverage> 105 implements java.io.Serializable 106 { 107 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 108 protected static final long serialVersionUID = 1; 109 110 private static final NestedHelper<Profiler.FunctionCoverage> singleton = 111 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 112 Profiler$$FunctionCoverage$$.singleton; 113 114 /** JavaScript function name. */ 115 public final String functionName; 116 117 /** Source ranges inside the function with coverage data. */ 118 public final Profiler.CoverageRange[] ranges; 119 120 /** Whether coverage data for this function has block granularity. */ 121 public final boolean isBlockCoverage; 122 123 /** Constructor. Please review this class' fields for documentation. */ 124 public FunctionCoverage( 125 ReadOnlyList<Boolean> isPresent, String functionName, CoverageRange[] ranges, 126 boolean isBlockCoverage 127 ) 128 { 129 super(singleton, Domains.Profiler, "FunctionCoverage", 3); 130 131 this.functionName = functionName; 132 this.ranges = ranges; 133 this.isBlockCoverage = isBlockCoverage; 134 135 this.isPresent = (isPresent == null) 136 ? singleton.generateIsPresentList(this) 137 : THROWS.check(isPresent, 3, "Profiler.FunctionCoverage"); 138 } 139 140 /** Creates an instance of this class from a {@link JsonObject}.*/ 141 public static FunctionCoverage fromJSON(JsonObject jo) 142 { return singleton.fromJSON(jo); } 143 144 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 145 public static NestedDescriptor<FunctionCoverage> descriptor() 146 { return singleton.descriptor(); } 147 } 148 149 /** 150 * Specifies a number of samples attributed to a certain source position. 151 * 152 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 153 */ 154 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 155 public static class PositionTickInfo 156 extends BaseType<PositionTickInfo> 157 implements java.io.Serializable 158 { 159 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 160 protected static final long serialVersionUID = 1; 161 162 private static final NestedHelper<Profiler.PositionTickInfo> singleton = 163 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 164 Profiler$$PositionTickInfo$$.singleton; 165 166 /** Source line number (1-based). */ 167 public final int line; 168 169 /** Number of samples attributed to the source line. */ 170 public final int ticks; 171 172 /** Constructor. Please review this class' fields for documentation. */ 173 public PositionTickInfo(ReadOnlyList<Boolean> isPresent, int line, int ticks) 174 { 175 super(singleton, Domains.Profiler, "PositionTickInfo", 2); 176 177 this.line = line; 178 this.ticks = ticks; 179 180 this.isPresent = (isPresent == null) 181 ? singleton.generateIsPresentList(this) 182 : THROWS.check(isPresent, 2, "Profiler.PositionTickInfo"); 183 } 184 185 /** Creates an instance of this class from a {@link JsonObject}.*/ 186 public static PositionTickInfo fromJSON(JsonObject jo) 187 { return singleton.fromJSON(jo); } 188 189 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 190 public static NestedDescriptor<PositionTickInfo> descriptor() 191 { return singleton.descriptor(); } 192 } 193 194 /** 195 * Profile. 196 * 197 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 198 */ 199 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 200 public static class Profile 201 extends BaseType<Profile> 202 implements java.io.Serializable 203 { 204 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 205 protected static final long serialVersionUID = 1; 206 207 private static final NestedHelper<Profiler.Profile> singleton = 208 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 209 Profiler$$Profile$$.singleton; 210 211 /** The list of profile nodes. First item is the root node. */ 212 public final Profiler.ProfileNode[] nodes; 213 214 /** Profiling start timestamp in microseconds. */ 215 public final Number startTime; 216 217 /** Profiling end timestamp in microseconds. */ 218 public final Number endTime; 219 220 /** 221 * Ids of samples top nodes. 222 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 223 */ 224 public final int[] samples; 225 226 /** 227 * Time intervals between adjacent samples in microseconds. The first delta is relative to the 228 * profile startTime. 229 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 230 */ 231 public final int[] timeDeltas; 232 233 /** Constructor. Please review this class' fields for documentation. */ 234 public Profile( 235 ReadOnlyList<Boolean> isPresent, ProfileNode[] nodes, Number startTime, 236 Number endTime, int[] samples, int[] timeDeltas 237 ) 238 { 239 super(singleton, Domains.Profiler, "Profile", 5); 240 241 this.nodes = nodes; 242 this.startTime = startTime; 243 this.endTime = endTime; 244 this.samples = samples; 245 this.timeDeltas = timeDeltas; 246 247 this.isPresent = (isPresent == null) 248 ? singleton.generateIsPresentList(this) 249 : THROWS.check(isPresent, 5, "Profiler.Profile"); 250 } 251 252 /** Creates an instance of this class from a {@link JsonObject}.*/ 253 public static Profile fromJSON(JsonObject jo) 254 { return singleton.fromJSON(jo); } 255 256 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 257 public static NestedDescriptor<Profile> descriptor() 258 { return singleton.descriptor(); } 259 } 260 261 /** 262 * Profile node. Holds callsite information, execution statistics and child nodes. 263 * 264 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 265 */ 266 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 267 public static class ProfileNode 268 extends BaseType<ProfileNode> 269 implements java.io.Serializable 270 { 271 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 272 protected static final long serialVersionUID = 1; 273 274 private static final NestedHelper<Profiler.ProfileNode> singleton = 275 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 276 Profiler$$ProfileNode$$.singleton; 277 278 /** Unique id of the node. */ 279 public final int id; 280 281 /** Function location. */ 282 public final RunTime.CallFrame callFrame; 283 284 /** 285 * Number of samples where this node was on top of the call stack. 286 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 287 */ 288 public final Integer hitCount; 289 290 /** 291 * Child node ids. 292 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 293 */ 294 public final int[] children; 295 296 /** 297 * The reason of being not optimized. The function may be deoptimized or marked as don't 298 * optimize. 299 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 300 */ 301 public final String deoptReason; 302 303 /** 304 * An array of source position ticks. 305 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 306 */ 307 public final Profiler.PositionTickInfo[] positionTicks; 308 309 /** Constructor. Please review this class' fields for documentation. */ 310 public ProfileNode( 311 ReadOnlyList<Boolean> isPresent, int id, RunTime.CallFrame callFrame, 312 Integer hitCount, int[] children, String deoptReason, 313 PositionTickInfo[] positionTicks 314 ) 315 { 316 super(singleton, Domains.Profiler, "ProfileNode", 6); 317 318 this.id = id; 319 this.callFrame = callFrame; 320 this.hitCount = hitCount; 321 this.children = children; 322 this.deoptReason = deoptReason; 323 this.positionTicks = positionTicks; 324 325 this.isPresent = (isPresent == null) 326 ? singleton.generateIsPresentList(this) 327 : THROWS.check(isPresent, 6, "Profiler.ProfileNode"); 328 } 329 330 /** Creates an instance of this class from a {@link JsonObject}.*/ 331 public static ProfileNode fromJSON(JsonObject jo) 332 { return singleton.fromJSON(jo); } 333 334 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 335 public static NestedDescriptor<ProfileNode> descriptor() 336 { return singleton.descriptor(); } 337 } 338 339 /** 340 * Coverage data for a JavaScript script. 341 * 342 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 343 */ 344 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI") 345 public static class ScriptCoverage 346 extends BaseType<ScriptCoverage> 347 implements java.io.Serializable 348 { 349 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 350 protected static final long serialVersionUID = 1; 351 352 private static final NestedHelper<Profiler.ScriptCoverage> singleton = 353 Torello.Browser.JavaScriptAPI.NestedHelpers.Types. 354 Profiler$$ScriptCoverage$$.singleton; 355 356 /** JavaScript script id. */ 357 public final String scriptId; 358 359 /** JavaScript script name or url. */ 360 public final String url; 361 362 /** Functions contained in the script that has coverage data. */ 363 public final Profiler.FunctionCoverage[] functions; 364 365 /** Constructor. Please review this class' fields for documentation. */ 366 public ScriptCoverage( 367 ReadOnlyList<Boolean> isPresent, String scriptId, String url, 368 FunctionCoverage[] functions 369 ) 370 { 371 super(singleton, Domains.Profiler, "ScriptCoverage", 3); 372 373 this.scriptId = scriptId; 374 this.url = url; 375 this.functions = functions; 376 377 this.isPresent = (isPresent == null) 378 ? singleton.generateIsPresentList(this) 379 : THROWS.check(isPresent, 3, "Profiler.ScriptCoverage"); 380 } 381 382 /** Creates an instance of this class from a {@link JsonObject}.*/ 383 public static ScriptCoverage fromJSON(JsonObject jo) 384 { return singleton.fromJSON(jo); } 385 386 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 387 public static NestedDescriptor<ScriptCoverage> descriptor() 388 { return singleton.descriptor(); } 389 } 390 391 392 // ******************************************************************************************** 393 // ******************************************************************************************** 394 // Command-Return Types 395 // ******************************************************************************************** 396 // ******************************************************************************************** 397 398 399 /** 400 * Collect coverage data for the current isolate, and resets execution counters. Precise code 401 * coverage needs to have started. 402 * 403 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI DATA-CMD=takePreciseCoverage> 404 * @see Profiler#takePreciseCoverage 405 */ 406 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI") 407 public static class takePreciseCoverage$$RET 408 extends BaseType<takePreciseCoverage$$RET> 409 implements java.io.Serializable 410 { 411 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 412 protected static final long serialVersionUID = 1; 413 414 private static final NestedHelper<Profiler.takePreciseCoverage$$RET> singleton = 415 Torello.Browser.JavaScriptAPI.NestedHelpers.CmdReturns. 416 Profiler$$takePreciseCoverage$$RET.singleton; 417 418 /** Coverage data for the current isolate. */ 419 public final Profiler.ScriptCoverage[] result; 420 421 /** Monotonically increasing time (in seconds) when the coverage update was taken in the backend. */ 422 public final Number timestamp; 423 424 /** Constructor. Please review this class' fields for documentation. */ 425 public takePreciseCoverage$$RET 426 (ReadOnlyList<Boolean> isPresent, ScriptCoverage[] result, Number timestamp) 427 { 428 super(singleton, Domains.Profiler, "takePreciseCoverage", 2); 429 430 this.result = result; 431 this.timestamp = timestamp; 432 433 this.isPresent = (isPresent == null) 434 ? singleton.generateIsPresentList(this) 435 : THROWS.check(isPresent, 2, "Profiler.takePreciseCoverage$$RET"); 436 } 437 438 /** Creates an instance of this class from a {@link JsonObject}.*/ 439 public static takePreciseCoverage$$RET fromJSON(JsonObject jo) 440 { return singleton.fromJSON(jo); } 441 442 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 443 public static NestedDescriptor<takePreciseCoverage$$RET> descriptor() 444 { return singleton.descriptor(); } 445 } 446 447 448 // ******************************************************************************************** 449 // ******************************************************************************************** 450 // Event Types 451 // ******************************************************************************************** 452 // ******************************************************************************************** 453 454 455 /** 456 * <CODE>[No Description Provided by Google]</CODE> 457 * 458 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 459 */ 460 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 461 public static class consoleProfileFinished 462 extends BrowserEvent<consoleProfileFinished> 463 implements java.io.Serializable 464 { 465 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 466 protected static final long serialVersionUID = 1; 467 468 private static final NestedHelper<Profiler.consoleProfileFinished> singleton = 469 Torello.Browser.JavaScriptAPI.NestedHelpers.Events. 470 Profiler$$consoleProfileFinished$$.singleton; 471 472 /** <CODE>[No Description Provided by Google]</CODE> */ 473 public final String id; 474 475 /** Location of console.profileEnd(). */ 476 public final Debugger.Location location; 477 478 /** <CODE>[No Description Provided by Google]</CODE> */ 479 public final Profiler.Profile profile; 480 481 /** 482 * Profile title passed as an argument to console.profile(). 483 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 484 */ 485 public final String title; 486 487 /** Constructor. Please review this class' fields for documentation. */ 488 public consoleProfileFinished( 489 ReadOnlyList<Boolean> isPresent, String id, Debugger.Location location, 490 Profile profile, String title 491 ) 492 { 493 super(singleton, Domains.Profiler, "consoleProfileFinished", 4); 494 495 this.id = id; 496 this.location = location; 497 this.profile = profile; 498 this.title = title; 499 500 this.isPresent = (isPresent == null) 501 ? singleton.generateIsPresentList(this) 502 : THROWS.check(isPresent, 4, "Profiler.consoleProfileFinished"); 503 } 504 505 /** Creates an instance of this class from a {@link JsonObject}.*/ 506 public static consoleProfileFinished fromJSON(JsonObject jo) 507 { return singleton.fromJSON(jo); } 508 509 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 510 public static NestedDescriptor<consoleProfileFinished> descriptor() 511 { return singleton.descriptor(); } 512 } 513 514 /** 515 * Sent when new profile recording is started using console.profile() call. 516 * 517 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 518 */ 519 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 520 public static class consoleProfileStarted 521 extends BrowserEvent<consoleProfileStarted> 522 implements java.io.Serializable 523 { 524 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 525 protected static final long serialVersionUID = 1; 526 527 private static final NestedHelper<Profiler.consoleProfileStarted> singleton = 528 Torello.Browser.JavaScriptAPI.NestedHelpers.Events. 529 Profiler$$consoleProfileStarted$$.singleton; 530 531 /** <CODE>[No Description Provided by Google]</CODE> */ 532 public final String id; 533 534 /** Location of console.profile(). */ 535 public final Debugger.Location location; 536 537 /** 538 * Profile title passed as an argument to console.profile(). 539 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 540 */ 541 public final String title; 542 543 /** Constructor. Please review this class' fields for documentation. */ 544 public consoleProfileStarted 545 (ReadOnlyList<Boolean> isPresent, String id, Debugger.Location location, String title) 546 { 547 super(singleton, Domains.Profiler, "consoleProfileStarted", 3); 548 549 this.id = id; 550 this.location = location; 551 this.title = title; 552 553 this.isPresent = (isPresent == null) 554 ? singleton.generateIsPresentList(this) 555 : THROWS.check(isPresent, 3, "Profiler.consoleProfileStarted"); 556 } 557 558 /** Creates an instance of this class from a {@link JsonObject}.*/ 559 public static consoleProfileStarted fromJSON(JsonObject jo) 560 { return singleton.fromJSON(jo); } 561 562 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 563 public static NestedDescriptor<consoleProfileStarted> descriptor() 564 { return singleton.descriptor(); } 565 } 566 567 /** 568 * Reports coverage delta since the last poll (either from an event like this, or from 569 * <CODE>takePreciseCoverage</CODE> for the current isolate. May only be sent if precise code 570 * coverage has been started. This event can be trigged by the embedder to, for example, 571 * trigger collection of coverage data immediately at a certain point in time. 572 * 573 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 574 * <EMBED CLASS=globalDefs DATA-DOMAIN=Profiler DATA-API=JavaScriptAPI> 575 */ 576 @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_EVENT_JDHBI") 577 public static class preciseCoverageDeltaUpdate 578 extends BrowserEvent<preciseCoverageDeltaUpdate> 579 implements java.io.Serializable 580 { 581 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 582 protected static final long serialVersionUID = 1; 583 584 private static final NestedHelper<Profiler.preciseCoverageDeltaUpdate> singleton = 585 Torello.Browser.JavaScriptAPI.NestedHelpers.Events. 586 Profiler$$preciseCoverageDeltaUpdate$$.singleton; 587 588 /** Monotonically increasing time (in seconds) when the coverage update was taken in the backend. */ 589 public final Number timestamp; 590 591 /** Identifier for distinguishing coverage events. */ 592 public final String occasion; 593 594 /** Coverage data for the current isolate. */ 595 public final Profiler.ScriptCoverage[] result; 596 597 /** Constructor. Please review this class' fields for documentation. */ 598 public preciseCoverageDeltaUpdate( 599 ReadOnlyList<Boolean> isPresent, Number timestamp, String occasion, 600 ScriptCoverage[] result 601 ) 602 { 603 super(singleton, Domains.Profiler, "preciseCoverageDeltaUpdate", 3); 604 605 this.timestamp = timestamp; 606 this.occasion = occasion; 607 this.result = result; 608 609 this.isPresent = (isPresent == null) 610 ? singleton.generateIsPresentList(this) 611 : THROWS.check(isPresent, 3, "Profiler.preciseCoverageDeltaUpdate"); 612 } 613 614 /** Creates an instance of this class from a {@link JsonObject}.*/ 615 public static preciseCoverageDeltaUpdate fromJSON(JsonObject jo) 616 { return singleton.fromJSON(jo); } 617 618 /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/ 619 public static NestedDescriptor<preciseCoverageDeltaUpdate> descriptor() 620 { return singleton.descriptor(); } 621 } 622 623 624 625 626 // ******************************************************************************************** 627 // ******************************************************************************************** 628 // Commands 629 // ******************************************************************************************** 630 // ******************************************************************************************** 631 632 633 /** 634 * <CODE>[No Description Provided by Google]</CODE> 635 * 636 * @return An instance of <CODE>{@link Script}<Void></CODE> 637 * 638 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 639 * browser receives the invocation-request. 640 * 641 * <BR /><BR /><DIV CLASS=JDHint> 642 * This Browser-Function <I>does not have</I> a return-value. You may choose to 643 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 644 * the Browser Function has run to completion. 645 * </DIV> 646 */ 647 public static Script<Void> disable() 648 { 649 // Ultra-Simple Request JSON - Because this method has no parameters 650 final String requestJSON = "{\"method\":\"Profiler.disable\"}"; 651 652 return Script.NO_RET(Domains.Profiler, "disable", requestJSON); 653 } 654 655 /** 656 * <CODE>[No Description Provided by Google]</CODE> 657 * 658 * @return An instance of <CODE>{@link Script}<Void></CODE> 659 * 660 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 661 * browser receives the invocation-request. 662 * 663 * <BR /><BR /><DIV CLASS=JDHint> 664 * This Browser-Function <I>does not have</I> a return-value. You may choose to 665 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 666 * the Browser Function has run to completion. 667 * </DIV> 668 */ 669 public static Script<Void> enable() 670 { 671 // Ultra-Simple Request JSON - Because this method has no parameters 672 final String requestJSON = "{\"method\":\"Profiler.enable\"}"; 673 674 return Script.NO_RET(Domains.Profiler, "enable", requestJSON); 675 } 676 677 /** 678 * Collect coverage data for the current isolate. The coverage data may be incomplete due to 679 * garbage collection. 680 * 681 * @return An instance of <CODE>{@link Script}<{@link Profiler.ScriptCoverage}[]></CODE> 682 * 683 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 684 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 685 * <CODE><{@link Profiler.ScriptCoverage}[]></CODE> will be returned 686 * 687 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 688 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 689 * be retrieved.</I> 690 * 691 * <BR /><BR /><DIV CLASS=JDHint> 692 * This Browser Function's {@code Promise} returns: 693 * <CODE>{@link Profiler.ScriptCoverage}[] (<B>result</B>)</CODE> 694 * <BR /> 695 * Coverage data for the current isolate. 696 * </DIV> 697 */ 698 public static Script<Profiler.ScriptCoverage[]> getBestEffortCoverage() 699 { 700 // Ultra-Simple Request JSON - Because this method has no parameters 701 final String requestJSON = "{\"method\":\"Profiler.getBestEffortCoverage\"}"; 702 703 return new Script<>( 704 Domains.Profiler, "getBestEffortCoverage", requestJSON, 705 Profiler$$Commands::getBestEffortCoverage, 706 Profiler.ScriptCoverage[].class 707 ); 708 } 709 710 /** 711 * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. 712 * 713 * @param interval New sampling interval in microseconds. 714 * 715 * @return An instance of <CODE>{@link Script}<Void></CODE> 716 * 717 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 718 * browser receives the invocation-request. 719 * 720 * <BR /><BR /><DIV CLASS=JDHint> 721 * This Browser-Function <I>does not have</I> a return-value. You may choose to 722 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 723 * the Browser Function has run to completion. 724 * </DIV> 725 */ 726 public static Script<Void> setSamplingInterval(int interval) 727 { 728 // Build the JSON Request-Object (as a String); only 1 Parameter is passed 729 final String requestJSON = WriteJSON.get 730 (CDPTypes.PRIMITIVE_INT, "interval", false, "Profiler.setSamplingInterval", interval); 731 732 return Script.NO_RET(Domains.Profiler, "setSamplingInterval", requestJSON); 733 } 734 735 /** 736 * <CODE>[No Description Provided by Google]</CODE> 737 * 738 * @return An instance of <CODE>{@link Script}<Void></CODE> 739 * 740 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 741 * browser receives the invocation-request. 742 * 743 * <BR /><BR /><DIV CLASS=JDHint> 744 * This Browser-Function <I>does not have</I> a return-value. You may choose to 745 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 746 * the Browser Function has run to completion. 747 * </DIV> 748 */ 749 public static Script<Void> start() 750 { 751 // Ultra-Simple Request JSON - Because this method has no parameters 752 final String requestJSON = "{\"method\":\"Profiler.start\"}"; 753 754 return Script.NO_RET(Domains.Profiler, "start", requestJSON); 755 } 756 757 /** 758 * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code 759 * coverage may be incomplete. Enabling prevents running optimized code and resets execution 760 * counters. 761 * 762 * @param callCount Collect accurate call counts beyond simple 'covered' or 'not covered'. 763 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 764 * 765 * @param detailed Collect block-based coverage. 766 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 767 * 768 * @param allowTriggeredUpdates Allow the backend to send updates on its own initiative 769 * <BR /><B CLASS=Opt-Top>OPTIONAL</B> 770 * 771 * @return An instance of <CODE>{@link Script}<Number></CODE> 772 * 773 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 774 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 775 * <CODE><Number></CODE> will be returned 776 * 777 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 778 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 779 * be retrieved.</I> 780 * 781 * <BR /><BR /><DIV CLASS=JDHint> 782 * This Browser Function's {@code Promise} returns: 783 * <CODE>Number (<B>timestamp</B>)</CODE> 784 * <BR /> 785 * Monotonically increasing time (in seconds) when the coverage update was taken in the backend. 786 * </DIV> 787 */ 788 public static Script<Number> startPreciseCoverage 789 (Boolean callCount, Boolean detailed, Boolean allowTriggeredUpdates) 790 { 791 // Convert all Method Parameters into a JSON Request-Object (as a String) 792 final String requestJSON = WriteJSON.get( 793 Profiler$$Commands.startPreciseCoverage$$, "Profiler.startPreciseCoverage", 794 callCount, detailed, allowTriggeredUpdates 795 ); 796 797 return new Script<>( 798 Domains.Profiler, "startPreciseCoverage", requestJSON, 799 jo -> ReadNumberJSON.get(jo, "timestamp", true, false), 800 Number.class 801 ); 802 } 803 804 /** 805 * <CODE>[No Description Provided by Google]</CODE> 806 * 807 * @return An instance of <CODE>{@link Script}<{@link Profiler.Profile}></CODE> 808 * 809 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 810 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 811 * <CODE><{@link Profiler.Profile}></CODE> will be returned 812 * 813 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 814 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 815 * be retrieved.</I> 816 * 817 * <BR /><BR /><DIV CLASS=JDHint> 818 * This Browser Function's {@code Promise} returns: 819 * <CODE>{@link Profiler.Profile} (<B>profile</B>)</CODE> 820 * <BR /> 821 * Recorded profile. 822 * </DIV> 823 */ 824 public static Script<Profiler.Profile> stop() 825 { 826 // Ultra-Simple Request JSON - Because this method has no parameters 827 final String requestJSON = "{\"method\":\"Profiler.stop\"}"; 828 829 return new Script<>( 830 Domains.Profiler, "stop", requestJSON, 831 Profiler$$Commands::stop, 832 Profiler.Profile.class 833 ); 834 } 835 836 /** 837 * Disable precise code coverage. Disabling releases unnecessary execution count records and allows 838 * executing optimized code. 839 * 840 * @return An instance of <CODE>{@link Script}<Void></CODE> 841 * 842 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 843 * browser receives the invocation-request. 844 * 845 * <BR /><BR /><DIV CLASS=JDHint> 846 * This Browser-Function <I>does not have</I> a return-value. You may choose to 847 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that 848 * the Browser Function has run to completion. 849 * </DIV> 850 */ 851 public static Script<Void> stopPreciseCoverage() 852 { 853 // Ultra-Simple Request JSON - Because this method has no parameters 854 final String requestJSON = "{\"method\":\"Profiler.stopPreciseCoverage\"}"; 855 856 return Script.NO_RET(Domains.Profiler, "stopPreciseCoverage", requestJSON); 857 } 858 859 /** 860 * Collect coverage data for the current isolate, and resets execution counters. Precise code 861 * coverage needs to have started. 862 * 863 * @return An instance of <CODE>{@link Script}<{@link takePreciseCoverage$$RET}></CODE> 864 * 865 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 866 * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise} 867 * <CODE><{@link takePreciseCoverage$$RET}></CODE> will be returned 868 * 869 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 870 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 871 * be retrieved.</I> 872 * 873 * <BR /><BR /><DIV CLASS=JDHint> 874 * This Browser Function's {@code Promise} returns:{@link takePreciseCoverage$$RET} 875 * A dedicated return type implies that the browser may return more than 1 datum 876 * </DIV> 877 */ 878 public static Script<takePreciseCoverage$$RET> takePreciseCoverage() 879 { 880 // Ultra-Simple Request JSON - Because this method has no parameters 881 final String requestJSON = "{\"method\":\"Profiler.takePreciseCoverage\"}"; 882 883 return new Script<>( 884 Domains.Profiler, "takePreciseCoverage", requestJSON, 885 takePreciseCoverage$$RET::fromJSON, 886 takePreciseCoverage$$RET.class 887 ); 888 } 889 890 891}