Skip to content

Instantly share code, notes, and snippets.

@onli
Created March 17, 2018 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onli/f3d295667cc5288b720eb01f3c1c5754 to your computer and use it in GitHub Desktop.
Save onli/f3d295667cc5288b720eb01f3c1c5754 to your computer and use it in GitHub Desktop.
module PCData
class Benchmark
# get the current online rating from the internet
def queryRating(hardware)
return getCpuRating(hardware.generic) if hardware.class.to_s == "Cpu"
return getGpuRating(hardware.generic) if hardware.class.to_s == "Gpu"
end
# get the current online rating and store it in the database
def updateRating(hardware)
rating = self.queryRating(hardware)
Database.instance.setRating(hardware, self.class.to_s, rating.to_s.tr(",", ".").to_f) if rating.to_f.respond_to?("zero?")
end
# returns the rating stored in the database and the current max rating
def getRating(hardware)
Database.instance.getRating(hardware.generic, self.class.to_s)
end
# returns the type of the higest rated hardware item
def highestType(hardware)
Database.instance.getHighestType(self.class.to_s, hardware)
end
# return all cpus benched in this benchmark
def getCpus()
return Database.instance.getBenchmarkCpus(self.class.to_s)
end
# return all cpus benched in this benchmark
def getGpus()
return Database.instance.getBenchmarkGpus(self.class.to_s)
end
def active
return true
end
def focus
return :games
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment