English中文

FrameRateMonitor

new Cesium.FrameRateMonitor(options)

监控帧速率(每秒帧数) Monitors the frame rate (frames per second) in a Scene 如果帧速率低于阈值,则引发事件。稍后,如果帧速率返回到所需的水平,则会引发一个单独的事件。避免为单个 FrameRateMonitor 创建多个 and raises an event if the frame rate is lower than a threshold. Later, if the frame rate returns to the required level, a separate event is raised. To avoid creating multiple FrameRateMonitors for a single Scene, 使用 , use FrameRateMonitor.fromScene 而不是显式地构造一个实例。 instead of constructing an instance explicitly.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
scene Scene 要监视性能的场景实例。 The Scene instance for which to monitor performance.
samplingWindow number 5.0 可选 optional 用于计算平均帧速率的滑动窗口的长度(以秒为单位)。 The length of the sliding window over which to compute the average frame rate, in seconds.
quietPeriod number 2.0 可选 optional 启动时以及每次页面变为可见时(即当用户切换回选项卡时)在开始测量性能之前等待的时间长度(以秒为单位)。 The length of time to wait at startup and each time the page becomes visible (i.e. when the user switches back to the tab) before starting to measure performance, in seconds.
warmupPeriod number 5.0 可选 optional 预热期的长度,以秒为单位。在预热期间,需要单独的(通常较低的)帧速率。 The length of the warmup period, in seconds. During the warmup period, a separate (usually lower) frame rate is required.
minimumFrameRateDuringWarmup number 4 可选 optional 预热期间可接受的性能所需的最小每秒帧数。如果在warmupPeriod期间的任何采样窗口期间平均帧速率低于此值,则将引发lowFrameRate事件,并且页面将重定向到redirectOnLowFrameRateUrl(如果有)。 The minimum frames-per-second that are required for acceptable performance during the warmup period. If the frame rate averages less than this during any samplingWindow during the warmupPeriod, the lowFrameRate event will be raised and the page will redirect to the redirectOnLowFrameRateUrl, if any.
minimumFrameRateAfterWarmup number 8 可选 optional 预热期结束后达到可接受的性能所需的最小每秒帧数。如果在warmupPeriod之后的任何采样窗口期间平均帧速率低于此值,则将引发lowFrameRate事件,并且页面将重定向到redirectOnLowFrameRateUrl(如果有)。 The minimum frames-per-second that are required for acceptable performance after the end of the warmup period. If the frame rate averages less than this during any samplingWindow after the warmupPeriod, the lowFrameRate event will be raised and the page will redirect to the redirectOnLowFrameRateUrl, if any.

成员 Members

static Cesium.FrameRateMonitor.defaultSettings : object

默认帧率监控设置。这些设置在以下情况下使用 The default frame rate monitoring settings. These settings are used when FrameRateMonitor.fromScene 需要创建一个新的帧速率监视器,并且对于任何未传递到的设置 needs to create a new frame rate monitor, and for any settings that are not passed to the FrameRateMonitor constructor.

lastFramesPerSecond : number

获取最近计算的过去的平均每秒帧数 Gets the most recently computed average frames-per-second over the last samplingWindow。如果尚未计算帧速率,则此属性可能未定义。 . This property may be undefined if the frame rate has not been computed.
获取检测到低帧速率时引发的事件。该函数将被传递 Gets the event that is raised when a low frame rate is detected. The function will be passed the Scene 实例作为其第一个参数,采样窗口内每秒的平均帧数作为其第二个参数。 instance as its first parameter and the average number of frames per second over the sampling window as its second parameter.

minimumFrameRateAfterWarmup : number

获取或设置在预热期结束后获得可接受的性能所需的最小每秒帧数。如果在任何期间帧速率平均值低于此值 Gets or sets the minimum frames-per-second that are required for acceptable performance after the end of the warmup period. If the frame rate averages less than this during any samplingWindow 之后 after the warmupPeriod, 的 , the lowFrameRate 将引发事件并且页面将重定向到 event will be raised and the page will redirect to the redirectOnLowFrameRateUrl,如果有的话。 , if any.

minimumFrameRateDuringWarmup : number

获取或设置在预热期间获得可接受的性能所需的最小每秒帧数。如果在任何期间帧速率平均值低于此值 Gets or sets the minimum frames-per-second that are required for acceptable performance during the warmup period. If the frame rate averages less than this during any samplingWindow 期间 during the warmupPeriod, 的 , the lowFrameRate 将引发事件并且页面将重定向到 event will be raised and the page will redirect to the redirectOnLowFrameRateUrl,如果有的话。 , if any.
获取当帧速率在较低水平后恢复到正常水平时引发的事件。该函数将被传递 Gets the event that is raised when the frame rate returns to a normal level after having been low. The function will be passed the Scene 实例作为其第一个参数,采样窗口内每秒的平均帧数作为其第二个参数。 instance as its first parameter and the average number of frames per second over the sampling window as its second parameter.
获取或设置启动时以及每次页面变为可见时(即当用户切换回选项卡时)在开始测量性能之前等待的时间长度(以秒为单位)。 Gets or sets the length of time to wait at startup and each time the page becomes visible (i.e. when the user switches back to the tab) before starting to measure performance, in seconds.
获取或设置用于计算平均帧速率的滑动窗口的长度(以秒为单位)。 Gets or sets the length of the sliding window over which to compute the average frame rate, in seconds.
得到 Gets the Scene 用于监视性能的实例。 instance for which to monitor performance.
获取或设置预热期的长度(以秒为单位)。在预热期间,需要单独的(通常较低的)帧速率。 Gets or sets the length of the warmup period, in seconds. During the warmup period, a separate (usually lower) frame rate is required.

方法 Methods

static Cesium.FrameRateMonitor.fromScene(scene)FrameRateMonitor

得到 Gets the FrameRateMonitor 对于给定的场景。如果场景还没有 for a given scene. If the scene does not yet have a FrameRateMonitor,一个是用 , one is created with the FrameRateMonitor.defaultSettings.
名称 Name 类型 Type 说明 Description
scene Scene 获取场景 The scene for which to get the FrameRateMonitor.
返回: Returns:
现场的 The scene's FrameRateMonitor.
取消订阅该实例正在侦听的所有事件。一旦对象被销毁,就不应再使用;调用除 Unsubscribes this instance from all events it is listening to. Once an object is destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError 例外。因此,分配返回值( exception. Therefore, assign the return value (undefined) 到对象,如示例中所做的那样。 ) to the object as done in the example.
抛出: Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
另见: See:
如果该对象被销毁则返回 true;否则为假。 Returns true if this object was destroyed; otherwise, false.

如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError exception.
返回: Returns:
如果该对象被销毁,则为 True;否则为假。 True if this object was destroyed; otherwise, false.
另见: See:
暂停监控帧速率。要恢复监控, Pauses monitoring of the frame rate. To resume monitoring, FrameRateMonitor#unpause 每次调用此函数时都必须调用一次。 must be called once for each time this function is called.
恢复帧速率监控。如果 Resumes monitoring of the frame rate. If FrameRateMonitor#pause 被多次调用,该函数必须被调用相同的次数才能真正恢复监视。 was called multiple times, this function must be called the same number of times in order to actually resume monitoring.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.