じ☆ve冰风 发表于 2026-8-1 20:19:54

RPG Maker VXAce Profiler

RPG Maker VXAce Profiler
 ​
Introduction
Primarily a scripter's tool. It helps you check out the performance of your game and is a lot more accurate than FPS relative values.
This script is made with Neonblack
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
 
% time 
The percent of the time spent inside the procedure itself (not counting children). 
cumulative seconds 
The total number of seconds spent in the procedure, including children. 
self seconds 
The total number of seconds spent in the procedure itself (not counting children). 
calls 
The total number of times the procedure was called. 
self ms/call 
The average time taken by the procedure itself on each call, in ms. 
total ms/call 
The average time taken by each call to the procedure, including time spent in child functions.
 
Screenshots

http://i.imgur.com/t7YbWtn.png


How to Use
Put this script below all other scripts but above main. 
Press CTRL to print to Console the results. 
 
Warning, it starts the game slow (like 0-4 FPS even) but it's accurate in performance display.
If graphics.update is skipped it means the game has a major lagspike on normal run. 

                Code:       
module CP_Profiler@@stacks = {}@@maps = {}@@start = 0    def self.begin    @@stacks = {}    @@maps = {}    @@start = Process.times    set_trace_func proc { |event, file, line, id, binding, klass|    case event    when "c-call", "call"      now = Process.times      stack = (@@stacks ||= [])      stack.push     when "c-return", "return"      now = Process.times      key = "#{klass}##{id}"      stack = (@@stacks ||= [])      if tick = stack.pop      threadmap = (@@maps ||= {})      data = (threadmap ||= )      data += 1      cost = now - tick      data += cost      data += cost - tick      stack[-1] += cost if stack[-1]      end    end    }end    def self.print    set_trace_func nil    total = Process.times    total = 0.01 if total == 0    totals = {}    @@maps.values.each do |threadmap|      threadmap.each do |key,data|      total_data = (totals ||= )      total_data += data      total_data += data      total_data += data      end    end    data = totals.values    data = data.sort_by{ |x| -x }    sum = 0    puts sprintf "   %%   cumulative   self            self   total\n"    puts sprintf "    time   seconds   seconds    callsms/callms/callname\n"    for d in data      break if d <= 0.0      sum += d      puts sprintf "%8.2f %8.2f%8.2f %8d %8.2f %8.2f%s\n",          d/total*100, sum, d, d, d*1000/d, d*1000/d, d    end    msgbox "Results printed to console.\nTracking reset."endendclass Scene_Basealias_method :cp_profiler_342341_update, :updatedef update(*args)    cp_profiler_342341_update(*args)    if Input.trigger?(:CTRL)      CP_Profiler.print      CP_Profiler.begin    endendendCP_Profiler.begin




本贴来自国际rpgmaker官方论坛作者:Archeia处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/rpg-maker-vxace-profiler.32930/
页: [1]
查看完整版本: RPG Maker VXAce Profiler