Skip to content

Commit

Permalink
IC/TS: Count number of gettextureinfo calls like we do for texture, e…
Browse files Browse the repository at this point in the history
…tc. (#2223)
  • Loading branch information
lgritz authored Apr 29, 2019
1 parent a6a9d38 commit 7f452c8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/libtexture/imagecache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ ImageCacheStatistics::init()
shadow_batches = 0;
environment_queries = 0;
environment_batches = 0;
imageinfo_queries = 0;
aniso_queries = 0;
aniso_probes = 0;
max_aniso = 1;
Expand Down Expand Up @@ -220,6 +221,7 @@ ImageCacheStatistics::merge(const ImageCacheStatistics& s)
shadow_batches += s.shadow_batches;
environment_queries += s.environment_queries;
environment_batches += s.environment_batches;
imageinfo_queries += s.imageinfo_queries;
aniso_queries += s.aniso_queries;
aniso_probes += s.aniso_probes;
max_aniso = std::max(max_aniso, s.max_aniso);
Expand Down Expand Up @@ -2299,6 +2301,15 @@ ImageCacheImpl::getattribute(string_view name, TypeDesc type, void* val) const
ATTR_DECODE("stat:tile_locking_time", float, stats.tile_locking_time);
ATTR_DECODE("stat:find_file_time", float, stats.find_file_time);
ATTR_DECODE("stat:find_tile_time", float, stats.find_tile_time);
ATTR_DECODE("stat:texture_queries", long long, stats.texture_queries);
ATTR_DECODE("stat:texture3d_queries", long long,
stats.texture3d_queries);
ATTR_DECODE("stat:environment_queries", long long,
stats.environment_queries);
ATTR_DECODE("stat:getimageinfo_queries", long long,
stats.imageinfo_queries);
ATTR_DECODE("stat:gettextureinfo_queries", long long,
stats.imageinfo_queries);
}

return false;
Expand Down Expand Up @@ -2544,6 +2555,8 @@ ImageCacheImpl::get_image_info(ImageCacheFile* file,
return true; \
}

ImageCacheStatistics& stats(thread_info->m_stats);
++stats.imageinfo_queries;
file = verify_file(file, thread_info, true);
if (dataname == s_exists && datatype == TypeInt) {
// Just check for existence. Need to do this before the invalid
Expand Down
1 change: 1 addition & 0 deletions src/libtexture/imagecache_pvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ struct ImageCacheStatistics {
long long shadow_batches;
long long environment_queries;
long long environment_batches;
long long imageinfo_queries;
long long aniso_queries;
long long aniso_probes;
float max_aniso;
Expand Down
5 changes: 4 additions & 1 deletion src/libtexture/texturesys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ TextureSystemImpl::getstats(int level, bool icstats) const
std::ostringstream out;
out.imbue(std::locale::classic()); // Force "C" locale with '.' decimal
bool anytexture = (stats.texture_queries + stats.texture3d_queries
+ stats.shadow_queries + stats.environment_queries);
+ stats.shadow_queries + stats.environment_queries
+ stats.imageinfo_queries);
if (level > 0 && anytexture) {
out << "OpenImageIO Texture statistics\n";

Expand Down Expand Up @@ -425,6 +426,8 @@ TextureSystemImpl::getstats(int level, bool icstats) const
<< stats.shadow_batches << " batches\n";
out << " environment : " << stats.environment_queries
<< " queries in " << stats.environment_batches << " batches\n";
out << " gettextureinfo : " << stats.imageinfo_queries
<< " queries\n";
out << " Interpolations :\n";
out << " closest : " << stats.closest_interps << "\n";
out << " bilinear : " << stats.bilinear_interps << "\n";
Expand Down

0 comments on commit 7f452c8

Please sign in to comment.