mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
pstats: Add collectors for texture/image reading/writing
This commit is contained in:
parent
0c4fe35a5c
commit
b526286d40
@ -70,6 +70,7 @@ ConfigVariableEnum<Texture::QualityLevel> texture_quality_level
|
|||||||
"renderers. See Texture::set_quality_level()."));
|
"renderers. See Texture::set_quality_level()."));
|
||||||
|
|
||||||
PStatCollector Texture::_texture_read_pcollector("*:Texture:Read");
|
PStatCollector Texture::_texture_read_pcollector("*:Texture:Read");
|
||||||
|
PStatCollector Texture::_texture_write_pcollector("*:Texture:Write");
|
||||||
TypeHandle Texture::_type_handle;
|
TypeHandle Texture::_type_handle;
|
||||||
TypeHandle Texture::CData::_type_handle;
|
TypeHandle Texture::CData::_type_handle;
|
||||||
AutoTextureScale Texture::_textures_power_2 = ATS_unspecified;
|
AutoTextureScale Texture::_textures_power_2 = ATS_unspecified;
|
||||||
@ -5198,6 +5199,8 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only)
|
|||||||
bool Texture::
|
bool Texture::
|
||||||
do_write(CData *cdata,
|
do_write(CData *cdata,
|
||||||
const Filename &fullpath, int z, int n, bool write_pages, bool write_mipmaps) {
|
const Filename &fullpath, int z, int n, bool write_pages, bool write_mipmaps) {
|
||||||
|
PStatTimer timer(_texture_write_pcollector);
|
||||||
|
|
||||||
if (is_txo_filename(fullpath)) {
|
if (is_txo_filename(fullpath)) {
|
||||||
if (!do_has_bam_rawdata(cdata)) {
|
if (!do_has_bam_rawdata(cdata)) {
|
||||||
do_get_bam_rawdata(cdata);
|
do_get_bam_rawdata(cdata);
|
||||||
|
@ -1088,6 +1088,7 @@ private:
|
|||||||
|
|
||||||
static AutoTextureScale _textures_power_2;
|
static AutoTextureScale _textures_power_2;
|
||||||
static PStatCollector _texture_read_pcollector;
|
static PStatCollector _texture_read_pcollector;
|
||||||
|
static PStatCollector _texture_write_pcollector;
|
||||||
|
|
||||||
// Datagram stuff
|
// Datagram stuff
|
||||||
public:
|
public:
|
||||||
|
@ -19,11 +19,16 @@
|
|||||||
#include "config_pnmimage.h"
|
#include "config_pnmimage.h"
|
||||||
#include "perlinNoise2.h"
|
#include "perlinNoise2.h"
|
||||||
#include "stackedPerlinNoise2.h"
|
#include "stackedPerlinNoise2.h"
|
||||||
|
#include "pStatCollector.h"
|
||||||
|
#include "pStatTimer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using std::max;
|
using std::max;
|
||||||
using std::min;
|
using std::min;
|
||||||
|
|
||||||
|
static PStatCollector _image_read_pcollector("*:PNMImage:read");
|
||||||
|
static PStatCollector _image_write_pcollector("*:PNMImage:write");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -319,6 +324,8 @@ read(std::istream &data, const std::string &filename, PNMFileType *type,
|
|||||||
*/
|
*/
|
||||||
bool PNMImage::
|
bool PNMImage::
|
||||||
read(PNMReader *reader) {
|
read(PNMReader *reader) {
|
||||||
|
PStatTimer timer(_image_read_pcollector);
|
||||||
|
|
||||||
bool has_read_size = _has_read_size;
|
bool has_read_size = _has_read_size;
|
||||||
int read_x_size = _read_x_size;
|
int read_x_size = _read_x_size;
|
||||||
int read_y_size = _read_y_size;
|
int read_y_size = _read_y_size;
|
||||||
@ -437,6 +444,8 @@ write(PNMWriter *writer) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PStatTimer timer(_image_write_pcollector);
|
||||||
|
|
||||||
writer->copy_header_from(*this);
|
writer->copy_header_from(*this);
|
||||||
|
|
||||||
if (!writer->supports_integer()) {
|
if (!writer->supports_integer()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user