1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Compare commits

..

No commits in common. "3c6a06f97ee1f027a1f67ccddb8b4c121b446561" and "a6c6943a6c3d0de8c1054979f314bcf8575f7d05" have entirely different histories.

3 changed files with 8 additions and 73 deletions

1
NEWS
View File

@ -20,7 +20,6 @@ v0.x.x (xxxx-xx-xx)
- Improved user experience in the symbol view window.
- Added support for Direct3D 11 instrumentation.
- Vulkan contexts can be now calibrated on Linux.
- Support loading zstd-compressed chrome traces.
v0.7.7 (2021-04-01)

View File

@ -6,24 +6,12 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <sys/stat.h>
#ifdef _MSC_VER
# define stat64 _stat64
#endif
#if defined __CYGWIN__ || defined __APPLE__
# define stat64 stat
#endif
#include "json.hpp"
#include "../../server/TracyFileWrite.hpp"
#include "../../server/TracyMmap.hpp"
#include "../../server/TracyWorker.hpp"
#include "../../zstd/zstd.h"
using json = nlohmann::json;
@ -53,59 +41,15 @@ int main( int argc, char** argv )
printf( "Loading...\r" );
fflush( stdout );
std::ifstream is( input );
if( !is.is_open() )
{
fprintf( stderr, "Cannot open input file!\n" );
exit( 1 );
}
json j;
const auto fnsz = strlen( input );
if( fnsz > 4 && memcmp( input+fnsz-4, ".zst", 4 ) == 0 )
{
FILE* f = fopen( input, "rb" );
if( !f )
{
fprintf( stderr, "Cannot open input file!\n" );
exit( 1 );
}
struct stat64 sb;
if( stat64( input, &sb ) != 0 )
{
fprintf( stderr, "Cannot open input file!\n" );
fclose( f );
exit( 1 );
}
const auto zsz = sb.st_size;
auto zbuf = (char*)mmap( nullptr, zsz, PROT_READ, MAP_SHARED, fileno( f ), 0 );
fclose( f );
if( !zbuf )
{
fprintf( stderr, "Cannot mmap input file!\n" );
exit( 1 );
}
const auto sz = ZSTD_getDecompressedSize( zbuf, zsz );
auto buf = new char[sz];
const auto res = ZSTD_decompress( buf, sz, zbuf, zsz );
munmap( zbuf, zsz );
if( ZSTD_isError( res ) )
{
delete[] buf;
fprintf( stderr, "Couldn't decompress input file (%s)!\n", ZSTD_getErrorName( res ) );
exit( 1 );
}
j = json::parse( buf, buf+sz );
delete[] buf;
}
else
{
std::ifstream is( input );
if( !is.is_open() )
{
fprintf( stderr, "Cannot open input file!\n" );
exit( 1 );
}
is >> j;
is.close();
}
is >> j;
is.close();
printf( "\33[2KParsing...\r" );
fflush( stdout );

View File

@ -3379,14 +3379,6 @@ You can customize the output with the following command line options:
Tracy can import data generated by other profilers. This external data cannot be directly loaded, but must be converted first. Currently there's only support for converting chrome:tracing data, through the \texttt{import-chrome} utility.
\begin{bclogo}[
noborder=true,
couleur=black!5,
logo=\bclampe
]{Compressed traces}
Tracy can import traces compressed with the Zstandard algorithm (for example, using the \texttt{zstd} command-line utility). Traces ending with \texttt{.zst} extension are assumed to be compressed.
\end{bclogo}
\begin{bclogo}[
noborder=true,
couleur=black!5,