Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# dfs_framemonitor
|
||||
|
||||
This resource is a standalone resource which automagically collects and logs client framerates to the databse for later analysation.
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
SQLyog Community
|
||||
MySQL - 10.4.13-MariaDB : Database - essentialmode
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
/*!40101 SET SQL_MODE=''*/;
|
||||
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
/*Table structure for table `metrics_fps` */
|
||||
|
||||
CREATE TABLE `metrics_fps` (
|
||||
`metrics_fps_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`lowFrames` int(3) DEFAULT NULL,
|
||||
`avgFrames` int(3) DEFAULT NULL,
|
||||
`highFrames` int(3) DEFAULT NULL,
|
||||
`source_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`date_recorded` datetime DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`metrics_fps_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=70587 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
@@ -0,0 +1,34 @@
|
||||
local LowFrame = 256
|
||||
local HighFrame = 0
|
||||
local Frames = {}
|
||||
local _TotalAvgFrames = 0
|
||||
local LastUpload = GetGameTimer()
|
||||
|
||||
|
||||
|
||||
AddEventHandler("playerSpawned", function ()
|
||||
local FPS = -1
|
||||
local LastCheck = GetGameTimer()
|
||||
while true do
|
||||
FPS = FPS + 1
|
||||
if LastUpload + 600000 < GetGameTimer() then
|
||||
for k, v in pairs(Frames) do _TotalAvgFrames = _TotalAvgFrames + v end
|
||||
if math.floor(_TotalAvgFrames/#Frames) == math.floor(_TotalAvgFrames/#Frames) then
|
||||
TriggerServerEvent("framemonitor:upload", LowFrame, math.floor(_TotalAvgFrames/#Frames), HighFrame)
|
||||
end
|
||||
LastUpload = GetGameTimer()
|
||||
LowFrame = 256
|
||||
HighFrame = 0
|
||||
Frames = {}
|
||||
_TotalAvgFrames = 0
|
||||
end
|
||||
if LastCheck + 1000 <= GetGameTimer() then
|
||||
LastCheck = GetGameTimer()
|
||||
table.insert(Frames, #Frames+1, FPS)
|
||||
if FPS < LowFrame then LowFrame = FPS end
|
||||
if FPS > HighFrame then HighFrame = FPS end
|
||||
FPS = 0
|
||||
end
|
||||
Wait(0)
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,5 @@
|
||||
RegisterNetEvent("framemonitor:upload")
|
||||
AddEventHandler("framemonitor:upload", function (Low, Avg, High)
|
||||
MySQL.Async.execute("INSERT INTO metrics_fps (`lowFrames`, `avgFrames`, `highFrames`, `source_id`) VALUES (@low, @avg, @high, @id)", {low = Low, avg = Avg, high = High,
|
||||
id = GetPlayerIdentifiers(source)[1]} )
|
||||
end)
|
||||
@@ -0,0 +1,16 @@
|
||||
fx_version 'bodacious'
|
||||
|
||||
game 'gta5'
|
||||
|
||||
description 'FPS Monitor'
|
||||
|
||||
version '1.0'
|
||||
|
||||
client_script 'framemonitor_cl.lua'
|
||||
|
||||
dependency 'mysql-async'
|
||||
|
||||
server_scripts {
|
||||
'@mysql-async/lib/MySQL.lua',
|
||||
'framemonitor_sv.lua'
|
||||
}
|
||||
Reference in New Issue
Block a user