Skip to content

Instantly share code, notes, and snippets.

@astojilj
Last active December 24, 2015 07:45
Show Gist options
  • Save astojilj/42ff870508b6bdac1479 to your computer and use it in GitHub Desktop.
Save astojilj/42ff870508b6bdac1479 to your computer and use it in GitHub Desktop.
I/GFX all before(20523): took 0.172307ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.099000ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.437923ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.314308ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.028307ms for 192*192 texture 4
I/GFX all before(20523): took 0.016385ms for 192*192 texture 4
I/GFX all before(20523): took 0.015308ms for 48*48 texture 4
I/GFX all before(20523): took 0.019923ms for 192*192 texture 4
I/GFX all before(20523): took 0.050385ms for 192*192 texture 4
I/GFX all before(20523): took 0.013154ms for 192*192 texture 4
I/GFX all before(20523): took 0.012385ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.012462ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.010923ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.155385ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.295692ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.149000ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.095231ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.077000ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.078307ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.080154ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.158846ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.413615ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.104923ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.133846ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.233692ms for 2320*1024 texture 4
I/GFX all before(20523): took 0.253461ms for 2320*1024 texture 4
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 9074924..69a8e76 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)
*
@@ -246,7 +269,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
return tex;
}
}
-
+ ELAPSE_START
// 2. Ask the generator to natively create one
{
ScopedGenerator generator(this);
@@ -259,6 +282,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo);
// 3. Ask the generator to return a compressed form that the GPU might support
+ {
SkAutoTUnref<SkData> data(this->refEncoded());
if (data) {
GrTexture* tex = load_compressed_into_texture(ctx, data, desc);
@@ -266,7 +290,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
return set_key_and_return(tex, key);
}
}
-
+ }
// 4. Ask the generator to return YUV planes, which the GPU can convert
{
ScopedGenerator generator(this);
@@ -276,7 +300,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
return set_key_and_return(tex, key);
}
}
-
+ ELAPSE_END("GFX all before", fInfo.width(), fInfo.height(), fInfo.colorType());
// 5. Ask the generator to return RGB(A) data, which the GPU can convert
SkBitmap bitmap;
if (this->tryLockAsBitmap(&bitmap, client, chint)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment