Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Tracy Profiler library to monitor performance #335

Merged
merged 46 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bf43919
Add unit tests for YUVData and web PNG format as vp8l
illidanstormrange Nov 5, 2024
42c93e0
Fix code format error
illidanstormrange Nov 5, 2024
c37ab75
Merge three yuv.txt into one data.yuv; Add some ASSERT and EXPECT
illidanstormrange Nov 5, 2024
514ae4c
Use Data::MakeFromfile replace Stream::MakeFormFile to Optimize code
illidanstormrange Nov 5, 2024
b1cfcd4
Fix code format error
illidanstormrange Nov 5, 2024
69f732d
Add canvas.atlas and PixelBuffer unit test
illidanstormrange Nov 5, 2024
d844ad4
Change ASSERT condition
illidanstormrange Nov 5, 2024
0407b14
Refine code and change the md5
illidanstormrange Nov 5, 2024
eae0a13
Merge main
illidanstormrange Nov 5, 2024
612c09e
Add some unit test about layer, and optimize DataView uint test
illidanstormrange Nov 6, 2024
1cb4810
merge main
illidanstormrange Nov 6, 2024
a88eb51
Update version.json
illidanstormrange Nov 6, 2024
52e0f39
Restore LayerTest.textLayer's surface width
illidanstormrange Nov 6, 2024
fff9f16
Update unit test version
illidanstormrange Nov 6, 2024
4a61379
Add ShaderSimulationMipmap unit test
illidanstormrange Nov 7, 2024
c7cca48
Update version.txt, fix code format error
illidanstormrange Nov 7, 2024
6f652d2
Restore npotTextureTileSupport to true
illidanstormrange Nov 7, 2024
c488ced
Rename ShaderSimulationMipmap to TileModeFallback
illidanstormrange Nov 7, 2024
98d0a76
Merge branch 'main' into feature/ljj_new_unit_test
illidanstormrange Nov 14, 2024
4ac2f75
Merge branch 'main' into feature/ljj_new_unit_test
illidanstormrange Nov 14, 2024
1fb20a3
Add TracyProfile module, measure the execution time of several functi…
illidanstormrange Nov 15, 2024
5f90df0
Enable profile when build type is Debug
illidanstormrange Nov 15, 2024
7b2f334
Add statistics for function execution time
illidanstormrange Nov 18, 2024
f9f790a
Merge branch 'main'into feature/ljj_new_unit_test
illidanstormrange Nov 21, 2024
e598166
Modify code format
illidanstormrange Nov 21, 2024
c8e7c59
Remove redundant code
illidanstormrange Nov 21, 2024
275d33a
Initialize the profiler tool commit using Tracy's native repository
illidanstormrange Nov 21, 2024
a1e561a
Change enable profiler to enable profiling.
illidanstormrange Nov 22, 2024
4617f2d
Third-party libraries tracy use the original git address; Change the …
illidanstormrange Nov 22, 2024
ca536d7
Merge two macros related to profiling in the cmake file
illidanstormrange Nov 22, 2024
a02582c
Simplify the profiling macro defined in CMAKE, ensure uniqueness.
illidanstormrange Nov 22, 2024
9fd2932
CMake adds the configuration to compile trace profiler
illidanstormrange Nov 22, 2024
35c3773
Merge branch 'main' into feature/ljj_new_unit_test
illidanstormrange Nov 22, 2024
d827264
Fix code format error
illidanstormrange Nov 22, 2024
8026879
Simplify Profiling related macro definitions
illidanstormrange Nov 22, 2024
67101f2
Merge branch 'main' into feature/ljj_new_unit_test
illidanstormrange Nov 22, 2024
e1f09e6
Add macro TRACY_NO_INVARIANT_CHECK=1 to avoid errors when running job…
illidanstormrange Nov 22, 2024
b86de17
Add compile option -DTRACY_NO_INVARIANT_CHECK=1
illidanstormrange Nov 22, 2024
af8f586
Add env TRACY_NO_INVARIANT_CHECK=1
illidanstormrange Nov 22, 2024
4dabb73
Replace the function name of TRACE_EVENT with __PRETTY_FUNCTION__;
illidanstormrange Nov 25, 2024
91d203a
During the execution of GitHub CI, set the environment variable TRACY…
illidanstormrange Nov 25, 2024
5090986
During the execution of GitHub CI, set the environment variable TRACY…
illidanstormrange Nov 25, 2024
2d4fcdf
Merge branch 'main' into feature/ljj_new_unit_test
illidanstormrange Nov 25, 2024
fcfad72
Fix initializer error
illidanstormrange Nov 25, 2024
435ff25
Add missing atomic header files
illidanstormrange Nov 25, 2024
8fefbe5
Remove the TracyProfiler server UI build in cmake
illidanstormrange Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Third-party libraries tracy use the original git address; Change the …
…trace_ macro to tracy_
  • Loading branch information
illidanstormrange committed Nov 22, 2024
commit 4617f2d665fd8889595d3a457f31fc11763f5393
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"dir": "third_party/expat"
},
{
"url": "${PAG_GROUP}/tracy.git",
"url": "https://github.com/wolfpld/tracy.git",
"commit": "759b4c3bfe207ab382c01080f0417aca5af4411a",
"dir": "third_party/tracy"
}
Expand Down
32 changes: 16 additions & 16 deletions src/core/Canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static FillStyle CreateFillStyle(const Paint* paint) {
}

void Canvas::drawLine(float x0, float y0, float x1, float y1, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawLine");
TRACY_ZONE_SCOPED_N("Canvas::drawLine");
Path path = {};
path.moveTo(x0, y0);
path.lineTo(x1, y1);
Expand All @@ -177,7 +177,7 @@ void Canvas::drawLine(float x0, float y0, float x1, float y1, const Paint& paint
}

void Canvas::drawRect(const Rect& rect, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawRect");
TRACY_ZONE_SCOPED_N("Canvas::drawRect");
if (paint.getStroke()) {
Path path = {};
path.addRect(rect);
Expand All @@ -192,28 +192,28 @@ void Canvas::drawRect(const Rect& rect, const Paint& paint) {
}

void Canvas::drawOval(const Rect& oval, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawOval");
TRACY_ZONE_SCOPED_N("Canvas::drawOval");
RRect rRect = {};
rRect.setOval(oval);
drawRRect(rRect, paint);
}

void Canvas::drawCircle(float centerX, float centerY, float radius, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawCircle");
TRACY_ZONE_SCOPED_N("Canvas::drawCircle");
Rect rect =
Rect::MakeLTRB(centerX - radius, centerY - radius, centerX + radius, centerY + radius);
drawOval(rect, paint);
}

void Canvas::drawRoundRect(const Rect& rect, float radiusX, float radiusY, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawRoundRect");
TRACY_ZONE_SCOPED_N("Canvas::drawRoundRect");
RRect rRect = {};
rRect.setRectXY(rect, radiusX, radiusY);
drawRRect(rRect, paint);
}

void Canvas::drawRRect(const RRect& rRect, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawRRect");
TRACY_ZONE_SCOPED_N("Canvas::drawRRect");
if (rRect.radii.isZero()) {
drawRect(rRect.rect, paint);
return;
Expand All @@ -232,13 +232,13 @@ void Canvas::drawRRect(const RRect& rRect, const Paint& paint) {
}

void Canvas::drawPath(const Path& path, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawPath");
TRACY_ZONE_SCOPED_N("Canvas::drawPath");
auto shape = Shape::MakeFrom(path);
drawShape(std::move(shape), paint);
}

void Canvas::drawShape(std::shared_ptr<Shape> shape, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawShape");
TRACY_ZONE_SCOPED_N("Canvas::drawShape");
if (shape == nullptr || paint.nothingToDraw()) {
return;
}
Expand Down Expand Up @@ -295,7 +295,7 @@ void Canvas::drawImage(std::shared_ptr<Image> image, const SamplingOptions& samp

void Canvas::drawImage(std::shared_ptr<Image> image, const SamplingOptions& sampling,
const Paint* paint, const Matrix* extraMatrix) {
TRACE_ZONE_SCOPED_N("Canvas::drawImage");
TRACY_ZONE_SCOPED_N("Canvas::drawImage");
if (image == nullptr || (paint && paint->nothingToDraw())) {
return;
}
Expand All @@ -319,7 +319,7 @@ void Canvas::drawImage(std::shared_ptr<Image> image, const SamplingOptions& samp

void Canvas::drawSimpleText(const std::string& text, float x, float y, const Font& font,
const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawSimpleText");
TRACY_ZONE_SCOPED_N("Canvas::drawSimpleText");
if (text.empty()) {
return;
}
Expand All @@ -329,7 +329,7 @@ void Canvas::drawSimpleText(const std::string& text, float x, float y, const Fon

void Canvas::drawGlyphs(const GlyphID glyphs[], const Point positions[], size_t glyphCount,
const Font& font, const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawGlyphs");
TRACY_ZONE_SCOPED_N("Canvas::drawGlyphs");
if (glyphCount == 0 || paint.nothingToDraw()) {
return;
}
Expand All @@ -341,7 +341,7 @@ void Canvas::drawGlyphs(const GlyphID glyphs[], const Point positions[], size_t

void Canvas::drawTextBlob(std::shared_ptr<TextBlob> textBlob, float x, float y,
const Paint& paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawTextBlob");
TRACY_ZONE_SCOPED_N("Canvas::drawTextBlob");
if (textBlob == nullptr || paint.nothingToDraw()) {
return;
}
Expand All @@ -354,13 +354,13 @@ void Canvas::drawTextBlob(std::shared_ptr<TextBlob> textBlob, float x, float y,
}

void Canvas::drawPicture(std::shared_ptr<Picture> picture) {
TRACE_ZONE_SCOPED_N("Canvas::drawPicture");
TRACY_ZONE_SCOPED_N("Canvas::drawPicture");
drawContext->drawPicture(std::move(picture), *mcState);
}

void Canvas::drawPicture(std::shared_ptr<Picture> picture, const Matrix* matrix,
const Paint* paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawPictureWithMatrix");
TRACY_ZONE_SCOPED_N("Canvas::drawPictureWithMatrix");
if (picture == nullptr) {
return;
}
Expand All @@ -378,7 +378,7 @@ void Canvas::drawPicture(std::shared_ptr<Picture> picture, const Matrix* matrix,

void Canvas::drawLayer(std::shared_ptr<Picture> picture, const MCState& state,
const FillStyle& style, std::shared_ptr<ImageFilter> imageFilter) {
TRACE_ZONE_SCOPED_N("Canvas::drawLayer");
TRACY_ZONE_SCOPED_N("Canvas::drawLayer");
if (imageFilter == nullptr && picture->records.size() == 1 && style.maskFilter == nullptr) {
LayerUnrollContext layerContext(drawContext, style);
picture->playback(&layerContext, state);
Expand All @@ -392,7 +392,7 @@ void Canvas::drawLayer(std::shared_ptr<Picture> picture, const MCState& state,
void Canvas::drawAtlas(std::shared_ptr<Image> atlas, const Matrix matrix[], const Rect tex[],
const Color colors[], size_t count, const SamplingOptions& sampling,
const Paint* paint) {
TRACE_ZONE_SCOPED_N("Canvas::drawAtlas");
TRACY_ZONE_SCOPED_N("Canvas::drawAtlas");
// TODO: Support blend mode, atlas as source, colors as destination, colors can be nullptr.
if (atlas == nullptr || count == 0 || (paint && paint->nothingToDraw())) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/core/DataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DataWrapper : public DataProvider {
}

std::shared_ptr<Data> getData() const override {
TRACE_ZONE_SCOPED_N("DataWrapper::getData");
TRACY_ZONE_SCOPED_N("DataWrapper::getData");
return data;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/GlyphRasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ GlyphRasterizer::~GlyphRasterizer() {
}

std::shared_ptr<ImageBuffer> GlyphRasterizer::onMakeBuffer(bool tryHardware) const {
TRACE_ZONE_SCOPED_N("GlyphRasterizer::onMakeBuffer");
TRACY_ZONE_SCOPED_N("GlyphRasterizer::onMakeBuffer");
auto mask = Mask::Make(width(), height(), tryHardware);
if (!mask) {
return nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/core/ImageCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

namespace tgfx {
std::shared_ptr<ImageCodec> ImageCodec::MakeFrom(const std::string& filePath) {
TRACE_ZONE_SCOPED_N("ImageCodec::MakeFrom");
TRACY_ZONE_SCOPED_N("ImageCodec::MakeFrom");
std::shared_ptr<ImageCodec> codec = nullptr;
auto stream = Stream::MakeFromFile(filePath);
if (stream == nullptr || stream->size() <= 14) {
Expand Down Expand Up @@ -137,7 +137,7 @@ std::shared_ptr<Data> ImageCodec::Encode(const Pixmap& pixmap, EncodedFormat for
}

std::shared_ptr<ImageBuffer> ImageCodec::onMakeBuffer(bool tryHardware) const {
TRACE_ZONE_SCOPED_N("ImageCodec::onMakeBuffer");
TRACY_ZONE_SCOPED_N("ImageCodec::onMakeBuffer");
auto pixelBuffer = PixelBuffer::Make(width(), height(), isAlphaOnly(), tryHardware);
if (pixelBuffer == nullptr) {
return nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/core/ImageDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ImageBufferWrapper : public ImageDecoder {
}

std::shared_ptr<ImageBuffer> decode() const override {
TRACE_ZONE_SCOPED_N("ImageBufferWrapper::decode");
TRACY_ZONE_SCOPED_N("ImageBufferWrapper::decode");
return imageBuffer;
}

Expand All @@ -68,7 +68,7 @@ class ImageGeneratorWrapper : public ImageDecoder {
}

std::shared_ptr<ImageBuffer> decode() const override {
TRACE_ZONE_SCOPED_N("ImageGeneratorWrapper::decode");
TRACY_ZONE_SCOPED_N("ImageGeneratorWrapper::decode");
return imageGenerator->makeBuffer(tryHardware);
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/ShapeRasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ShapeRasterizer::ShapeRasterizer(int width, int height, std::shared_ptr<Shape> s
}

std::shared_ptr<ShapeBuffer> ShapeRasterizer::makeRasterized(bool tryHardware) const {
TRACE_ZONE_SCOPED_N("ShapeRasterizer::makeRasterized");
TRACY_ZONE_SCOPED_N("ShapeRasterizer::makeRasterized");
auto finalPath = shape->getPath();
if (PathTriangulator::ShouldTriangulatePath(finalPath)) {
return ShapeBuffer::MakeFrom(makeTriangles(finalPath));
Expand All @@ -38,7 +38,7 @@ std::shared_ptr<ShapeBuffer> ShapeRasterizer::makeRasterized(bool tryHardware) c
}

std::shared_ptr<ImageBuffer> ShapeRasterizer::onMakeBuffer(bool tryHardware) const {
TRACE_ZONE_SCOPED_N("ShapeRasterizer::onMakeBuffer");
TRACY_ZONE_SCOPED_N("ShapeRasterizer::onMakeBuffer");
auto finalPath = shape->getPath();
return makeImageBuffer(finalPath, tryHardware);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/SolidLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace tgfx {
std::shared_ptr<SolidLayer> SolidLayer::Make() {
TRACE_ZONE_SCOPED_N("SolidLayer::Make");
TRACY_ZONE_SCOPED_N("SolidLayer::Make");
auto layer = std::shared_ptr<SolidLayer>(new SolidLayer());
layer->weakThis = layer;
return layer;
Expand Down
Loading