Skip to content

Instantly share code, notes, and snippets.

@astojilj
Last active December 24, 2015 11:37
Show Gist options
  • Save astojilj/89c4ffbd758b89b93540 to your computer and use it in GitHub Desktop.
Save astojilj/89c4ffbd758b89b93540 to your computer and use it in GitHub Desktop.
measurement with patch
I/GFX all (18555): took 0.001231ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001154ms for 192*192 texture 4
I/GFX all (18555): took 0.001384ms for 192*192 texture 4
I/GFX all (18555): took 0.001384ms for 48*48 texture 4
I/GFX all (18555): took 0.001385ms for 192*192 texture 4
I/GFX all (18555): took 0.001154ms for 192*192 texture 4
I/GFX all (18555): took 0.001076ms for 192*192 texture 4
I/GFX all (18555): took 0.001231ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001770ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001385ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001539ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001231ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001154ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001462ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001154ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001154ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001385ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001308ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001923ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001616ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001308ms for 2320*1024 texture 4
I/GFX all (18555): took 0.002307ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001462ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001154ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001692ms for 2320*1024 texture 4
I/GFX all (18555): took 0.001384ms for 2320*1024 texture 4
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 2124d65..0a04045 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -229,6 +229,29 @@ static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) {
return tex;
}
+#define SKGR_DEBUG
+#ifdef SKGR_DEBUG
+
+#include <android/log.h>
+
+#include <time.h>
+
+using namespace std;
+static double elapsed(timespec start, timespec end)
+{
+ return (end.tv_sec-start.tv_sec)*1000 + (end.tv_nsec-start.tv_nsec) * 0.000001;
+}
+
+#define ELAPSE_START timespec time1, time2; clock_gettime(CLOCK_MONOTONIC, &time1);
+
+#define ELAPSE_END(a, ...) clock_gettime(CLOCK_MONOTONIC, &time2); \
+ double elapsedMiliseconds = elapsed(time1, time2); \
+ __android_log_print(ANDROID_LOG_INFO, a, "took %fms for %d*%d texture %d", elapsedMiliseconds, __VA_ARGS__);
+#else
+#define ELAPSE_START
+#define ELAPSE_END(a, ...)
+#endif
+
/*
* We have a 5 ways to try to return a texture (in sorted order)
*
@@ -248,6 +271,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
}
{
+ ELAPSE_START
ScopedGenerator generator(this);
// 2. Ask the generator to natively create one
@@ -279,6 +303,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
return set_key_and_return(tex, key);
}
}
+ ELAPSE_END("GFX all", fInfo.width(), fInfo.height(), fInfo.colorType());
}
// 5. Ask the generator to return RGB(A) data, which the GPU can convert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment