-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Document Stream Format #48
Comments
Here is description of the latest file format |
@cas4ey Nice! That is better than I was thinking it would be. Some of the ends of the titles are being cut off, btw, but that isn't a big issue. I'm probably going to write some code that can write theses files as text for debugging purposes. Also, what program did you use to make the diagrams? |
I have used draw.io and it has cut some ends of the labels when converted diagram to PNG image |
Is the format specifically little-endian? If not, I think it should be. That might avoid a little bit of confusion. On a different note, I just got tripped up by the documentation. The file version is documented as major, minor, and a patch number, and they look like separate fields. In my simple little test program, I ended up creating a struct for the header like this:
When really it's packed into a uint32_t. |
Good point, thanks.
We keep version in a single As for the rest: OK, I will modify the diagram, but until that moment you can find the types here and here. |
In the next version of the .prof format, could you make it so that |
It is better to use packed structs when writing/reading from files and currently all data in .prof file are aligned to 1 byte boundary so I don't really understand what padding are you talking about? |
@cas4ey Why is better to use packed structs? That is what I was talking about. If you make a structure exactly like the documentation, you get padding between the Do you do many unaligned accesses in the code for this kind of thing. My ARM platform is ARMv5 and that might be part of the issue (which I am still having, btw. It would seem that you misread my last email :) ). |
Doesn't struct aligned to 1 byte boundary more portable than default aligned struct (while we are profiling on one CPU type and viewing results on another one)?
There are a lot of accesses from gui, but not from the core.
Yes it seems that I have misunderstood your last email. My bad :-) |
@cas4ey It wouldn't make a difference in portability of the format, as it would still technically be aligned to a 1 byte boundary. It's just that it would make reading things like the header faster and easier. Plus, reading into a packed struct could actually make your code less portable on platforms that don't allow unaligned access. No matter the platform(as far as I know), a
Won't have any padding in it, so I can just
Forces you to read some fields individually. It's not really that big of a deal in the long run, it's just annoying for what I am trying to do. However, if you read into a packed struct and use it, you could run into problems on platforms that forbid unaligned access. In the best case, it will still slow things down. In other news, I am getting close to the issue on my platform. Block names are sometimes being corrupted and blocks that are there are getting a zero size in them. I'm writing a little third-party .prof parser for this kind of debugging. Once I narrow it down, I will let you know. |
@cas4ey for what its worth i think @rationalcoder is right. It costs nothing to move struct members around. If it makes working with these structs easier then its a free win. |
I don't mind against rearranging a couple of elements. I just always thought that padding is system dependent (mainly on CPU) and the main goal of packing data to 1 byte boundary is portability of this data between different systems. That is why I'm posting a lot or comments here :-) |
@rokups I would just like to make sure it's clear that the structs I have shown don't exist in easy_profiler, only in my third-party program that I am using to debug some issues. What I am asking is for the next version of the .prof format to move the @cas4ey My last point was that, no matter the alignment of Honestly, it's not that big of a deal, though, as long as you aren't using using packed structs in your project. The end result is saving a few |
I have updated a picture (underlying types has been added).
Well, as I know this is true also for desktop CPUs, not only for ARMs :-)
Then it would be better to postpone these changes :-) I'll rearrange file-header members, but other structures may cause serious troubles. |
File header has been rearranged struct EasyFileHeader
{
uint32_t signature = 0;
uint32_t version = 0;
processid_t pid = 0; // uint64_t
int64_t cpu_frequency = 0;
profiler::timestamp_t begin_time = 0; // uint64_t
profiler::timestamp_t end_time = 0; // uint64_t
uint64_t memory_size = 0;
uint64_t descriptors_memory_size = 0;
uint32_t total_blocks_number = 0;
uint32_t total_descriptors_number = 0;
}; |
Latest file format |
* (#31) Added possibility to save user metrics (a.k.a. arbitrary values) * `#include <easy/arbitrary_value.h>` * Use `EASY_VALUE("Name", variable_ref);` // See more options at `easy/arbitrary_value.h` * Added file converter (currently only .prof to .json is supported) * (#75) There is no need anymore to wait all threads finish their opened frames when dumping blocks to file/stream * (#81) Added CMake option to choose function names format * Added CMake option `EASY_PROFILER_NO_GUI` to build without `profiler_gui` * (#48) Minimized paddings in .prof file header * Bug fixes * Fixed `EASY_ENABLE_ALIGNMENT` build error * (#75) Fixed UI freeze when hitting `Cancel` button while transmitting profiled blocks from profiled application to the UI * Mac: Added support for building with Apple LLVM clang version < 8.0 * Add support for building with pre 2016 Apple LLVM clang * Automatically detect Apple clang that do not support thread_local * Clarify clang thread_local support code comment * (#72) Windows: VS2017 build fix * Unix: Context switch logger gets the processor cycle counter instead of time of a day * Other bug fixes * (#31) Added arbitrary values viewer * (#100) Added possibility to zoom in selected region * (#91) Added possibility to take a snapshot. Now you can save selected area to separate file. Works both with blue selection (hold right mouse button + move) and black ruler (double-click + hold mouse button + move) * Improved UI styles * Blocks histogram (under Diagram scene) is now resizeable * (#89) Added viewport info widget. See [Settings] -> [See viewport info] * Bug fixes * Fixed hierarchy building for zero duration blocks - events and arbitrary values are always visible * (#89) Trying to fix high-dpi displays problem (maybe not fixed 😞 ) * Other bug fixes
* yse#31 intermediate commit: added basic API for arbitrary values profiling. Still not working. * yse#31 build fix * yse#31 added arbitrary value id * yse#75 Windows build (cherry picked from commit ec720bf) * #0 [Core] Added constexpr support macros and refactored extract_... functions * yse#31 [Core] further work on arbitrary values * #0 [Core] Rearranged include files * #0 [Core] A lot of code refactoring * #0 [Core][GUI] refactoring * #0 [Core] refactoring * #0 [Core] Windows build * #0 Windows build * #0 Build fix >:E * yse#31 Single arbitrary values can be displayed in GUI as events + value converted to text * #0 [GUI] Styling * #0 [GUI] Styling * #0 MSVC2013 build * #0 [GUI] Warning fix: typo, forgotten return * #0 [GUI] Styling * yse#31 arbitrary value interface small refactoring * #0 [GUI] Styling * #0 [GUI] Styling * #0 [GUI] Styling. Themes. * #0 [GUI] Styling and optimization * #0 [GUI] Windows styling and consterxpr fix for some Qt versions * yse#81 [Core] Added an option to choose function names format * yse#31 [GUI] Arbitrary values viewer progress * #0 [GUI] Appearance progress * yse#31 [GUI] Arbitrary values viewer progress * #0 [GUI] Appearance * #0 [GUI] HierarchyTree: Finally replaced colored rows with colored squares in front of block name. These squares can not be turned off from now. * yse#31 [GUI] Arbitrary values viewer begin. Refactoring. * yse#31 [Core] Fixed issue with storing arbitrary value while dumping. // [GUI] Further values viewer progress. * Sample: build when SAMPLE_NETWORK_TEST is undefined * minor refactoring * yse#31 Basic arbitrary values viewer chart * Windows build * Older compiler build * Older compiler build * yse#75 [Core] No more waiting behavior when dumping blocks. Current solution resolves possible dead-lock but restricts any Events out of Frame bounds (You can see that the last event for LoadingResources thread in the profiler_sample is always absent). * Install with include hierarhy * yse#75 [Core] No waiting when dumping blocks. All events should now be stored properly. * Release 2.0 further work. Intermediate commit. * yse#31 [Gui] Big update for arbitrary values viewer. It is now viable and can be used to inspect user metrics. Currently arbitrary values viewer is built into blocks list widget. * #0 [Gui] Saving dialog geometry; Added refresh button to arbitrary values widget; Fixed zoom-in algorithm * yse#31 [Gui] Arbitrary values viewer bug fixes * #0 [Gui] Large portion of refactoring; Replaced bunch of threads with thread pool; Small fixes for arbitrary values viewer * #0 Updated copyright dates; [Gui] thread_pool.cpp MSVC build fix; [Core] Renamed getCurrentTime() to profiler::clock::now() + renamed profiler::currentTime() to profiler::now() * #0 Simplified some lambdas * yse#89 Trying to fix high-dpi displays problem * yse#31 [Gui] Intermediate commit: implementing O(n) chart (kinda...) to be able to analyse algorithm complexity depending on certain arbitrary value * yse#31 [Gui] Complexity charts for arbitrary value viewer * yse#31 [Gui] Hide slider when displaying complexity chart * yse#31 [Gui] Arbitrary values viewer: fixed performance problem, added icons for chart types * yse#31 [Gui] Fixed mouse indicator for complexity chart; fixed buildTree(); added stub for future export values to .csv * #0 [Gui] Fixed popup and double click on thread names on Diagram * yse#31 [Gui] Fixed appox. line painting for complexity chart; Added export to .csv for regular chart type (timestamp;value); * #0 [Gui] Paint background for current item for tree-widget * Add math functions for calculation complexity * yse#67 [Converter] Build fix after merging to release_2_0 * #0 [Gui] TreeView style fixes * #0 [Gui] Thread pool fix: there was a possibility that not all tasks would be executed * #0 [Gui] Added background jobs to thread pool and removed detached threads from code * yse#31 [Gui] Implemented zoom for complexity chart mode; Implemented export to .csv for complexity mode * #0 [Gui] Mac build fix * #0 [Gui] Fixed typo * #0 [Gui] Windows styling fix * yse#31 [Core] Arbitrary values: replaced size_t with uint16_t; [Gui] Added support of arrays to arbitrary values tree * #0 [Gui] Fixed hierarchy building for zero duration blocks - events and arbitrary values are always visible * yse#31 [Gui] Double click on arbitrary value on the Diagram will open values viewer and will select appropriate arbitrary value * yse#31 [UI] Open several arbitrary values viewer windows * yse#31 [UI] Arbitrary values: fixed multi-window viewer * yse#31 [UI] Highlight current selected block boundaries on arbitrary value chart * yse#31 [UI] Fixed current block boundaries painting * #0 [UI] Added viewport info widget. See [Settings] -> [See viewport info] * yse#100 [UI] Implemented zoom-in button * #0 [UI] Adjusted search boxes in Hierarchy widget and Blocks Descriptors Widget * yse#31 [UI] Added arbitrary value tool-tip to Hierarchy tree widget (Try to move mouse cursor over Name column) * yse#31 [UI] Added tooltip for arbitrary values to the Diagram * yse#31 [UI] Amend. Forgotten files. * #0 [UI] Diagram tool-tips fix: no tool-tips if mouse cursor is over another widget (opened settings for example) * #0 [UI] Arbitrary value ToolTip styling fix; Viewport info fix; * yse#48 [Core] Rearranged file header members order to minimize padding; [Core] Changed version to 2.0.0; * #0 Update README.md * yse#67 [Converter] Rewrote json converter, arbitrary values would be added soon * yse#91 [UI] Added snapshot tool stub; Working on saving blocks to file from UI * yse#91 [UI] Snapshot feature further progress (intermediate commit) * yse#91 [UI] Snapshot icon (actually called "crop") * #0 [core] installing profiler_converter * yse#91 [UI] .prof serializator (intermediate commit) * yse#91 [Core][UI] functions profiler::writeTreesToFile(), profiler::writeTreesToStream() are now working. Snapshot feature is now working: select an area on Diagram (with right mouse button or double-click) and press Snapshot button to save it to separate file. * #0 [Sample] Rollback - profiler_sample is standalone again (do not need to connect gui) * #0 Update readme * #0 Added new UI image to README.md * Update README.md * #0 [Core] refactoring * #0 [UI] refactoring * #0 [Core] Windows build * #0 [Core] refactoring * #0 [Core] findRange() fix for writeTreesToStream() * #0 [Core] fixed typo * yse#108 fix [Core] clang build for arbitrary values * #0 [UI] Tooltip fix * yse#89 [UI] High DPI displays fix + System scaling factor * # [UI] Styles and refactoring * #0 [UI] UI styles * #0 [Misc] modified gitignore * #0 [UI] Style * #0 [UI] refactoring * #0 [UI] Fixed zooming for charts (histogram, arbitrary value) with mouse wheel * #0 [Misc] Update README.md * #0 Updated image in README.md * yse#106 [Core][UI] Added possibility to add user bookmarks with double-clicking on a timeline in the Diagram window. yse#112 [UI] Fixed losing focus (and getting under MainWindow) for Blocks widget. #0 [UI] UI styling, added custom window header and dialogs (could be turned off/on and adjusted position at [Settings -> Appearance] menu). * yse#106 [UI] Rising a tooltip when passing cursor over a bookmark; #0 [UI] Minor fixes * yse#106 [Core][UI] Fixed reading bookmarks with empty text; Fixed overriding and restoring mouse cursor shape when hovering bookmark at the Diagram widget; #0 [UI] Waiting until saving file is finished when closing the UI. * Update README.md * Update README.md
I'm having an issue with a serialized block size having a zero in it, despite there actually being a block there. I'm having a really hard time debugging it without fully understanding the contents of a stream.
The text was updated successfully, but these errors were encountered: