add benchType deserial to time deserializing pictures
Piece of the larger effort to merge readbuffer and validatingreadbuffer Bug: skia: Change-Id: I79305e27c4712c3b91d213d09d6c2ef24b86e671 Reviewed-on: https://skia-review.googlesource.com/81120 Commit-Queue: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
2a3985e98d
commit
e45ff46a65
@ -85,3 +85,30 @@ void PipingBench::onDraw(int loops, SkCanvas*) {
|
||||
stream.reset();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include "SkSerialProcs.h"
|
||||
|
||||
DeserializePictureBench::DeserializePictureBench(const char* name, sk_sp<SkData> data)
|
||||
: fName(name)
|
||||
, fEncodedPicture(std::move(data))
|
||||
{}
|
||||
|
||||
const char* DeserializePictureBench::onGetName() {
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
bool DeserializePictureBench::isSuitableFor(Backend backend) {
|
||||
return backend == kNonRendering_Backend;
|
||||
}
|
||||
|
||||
SkIPoint DeserializePictureBench::onGetSize() {
|
||||
return SkIPoint::Make(128, 128);
|
||||
}
|
||||
|
||||
void DeserializePictureBench::onDraw(int loops, SkCanvas*) {
|
||||
SkDeserialProcs procs;
|
||||
for (int i = 0; i < loops; ++i) {
|
||||
SkPicture::MakeFromData(fEncodedPicture, procs);
|
||||
}
|
||||
}
|
||||
|
@ -53,4 +53,21 @@ private:
|
||||
typedef PictureCentricBench INHERITED;
|
||||
};
|
||||
|
||||
class DeserializePictureBench : public Benchmark {
|
||||
public:
|
||||
DeserializePictureBench(const char* name, sk_sp<SkData> encodedPicture);
|
||||
|
||||
protected:
|
||||
const char* onGetName() override;
|
||||
bool isSuitableFor(Backend) override;
|
||||
SkIPoint onGetSize() override;
|
||||
void onDraw(int loops, SkCanvas*) override;
|
||||
|
||||
private:
|
||||
SkString fName;
|
||||
sk_sp<SkData> fEncodedPicture;
|
||||
|
||||
typedef Benchmark INHERITED;
|
||||
};
|
||||
|
||||
#endif//RecordingBench_DEFINED
|
||||
|
@ -607,6 +607,7 @@ public:
|
||||
, fGMs(skiagm::GMRegistry::Head())
|
||||
, fCurrentRecording(0)
|
||||
, fCurrentPiping(0)
|
||||
, fCurrentDeserialPicture(0)
|
||||
, fCurrentScale(0)
|
||||
, fCurrentSKP(0)
|
||||
, fCurrentSVG(0)
|
||||
@ -765,6 +766,21 @@ public:
|
||||
return new PipingBench(name.c_str(), pic.get());
|
||||
}
|
||||
|
||||
// Add all .skps as DeserializePictureBenchs.
|
||||
while (fCurrentDeserialPicture < fSKPs.count()) {
|
||||
const SkString& path = fSKPs[fCurrentDeserialPicture++];
|
||||
sk_sp<SkData> data = SkData::MakeFromFileName(path.c_str());
|
||||
if (!data) {
|
||||
continue;
|
||||
}
|
||||
SkString name = SkOSPath::Basename(path.c_str());
|
||||
fSourceType = "skp";
|
||||
fBenchType = "deserial";
|
||||
fSKPBytes = static_cast<double>(data->size());
|
||||
fSKPOps = 0;
|
||||
return new DeserializePictureBench(name.c_str(), std::move(data));
|
||||
}
|
||||
|
||||
// Then once each for each scale as SKPBenches (playback).
|
||||
while (fCurrentScale < fScales.count()) {
|
||||
while (fCurrentSKP < fSKPs.count()) {
|
||||
@ -1091,6 +1107,7 @@ private:
|
||||
const char* fBenchType; // How we bench it: micro, recording, playback, ...
|
||||
int fCurrentRecording;
|
||||
int fCurrentPiping;
|
||||
int fCurrentDeserialPicture;
|
||||
int fCurrentScale;
|
||||
int fCurrentSKP;
|
||||
int fCurrentSVG;
|
||||
|
Loading…
Reference in New Issue
Block a user