1
0
mirror of https://github.com/wolfpld/tracy synced 2025-01-15 20:08:00 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Bartosz Taudul
05b5f1cfe1
Update manual. 2021-05-11 01:57:10 +02:00
Bartosz Taudul
8bdae80960
Update NEWS. 2021-05-11 01:43:07 +02:00
Bartosz Taudul
4f76fb2cda
Store location in SourceLocation during chrome import. 2021-05-11 01:37:59 +02:00
Bartosz Taudul
db734e3e0a
Parse custom location tags. 2021-05-11 01:37:59 +02:00
5 changed files with 38 additions and 6 deletions

4
NEWS
View File

@ -21,6 +21,10 @@ v0.x.x (xxxx-xx-xx)
- Added support for Direct3D 11 instrumentation.
- Vulkan contexts can be now calibrated on Linux.
- Support loading zstd-compressed chrome traces.
- Chrome traces with multiple PID entries (and possibly conflicting TIDs)
can be now imported. A pseudo-TID will be created for each PID+TID pair
in such circumstances.
- Added support for custom source location tag ("loc") in chrome traces.
v0.7.7 (2021-04-01)

View File

@ -199,6 +199,23 @@ int main( int argc, char** argv )
}
}
std::string locFile;
uint32_t locLine = 0;
if( v.contains( "loc" ) )
{
auto loc = v["loc"].get<std::string>();
const auto lpos = loc.find_last_of( ':' );
if( lpos == std::string::npos )
{
std::swap( loc, locFile );
}
else
{
locFile = loc.substr( 0, lpos );
locLine = atoi( loc.c_str() + lpos + 1 );
}
}
if( type == "B" )
{
timeline.emplace_back( tracy::Worker::ImportEventTimeline {
@ -206,7 +223,9 @@ int main( int argc, char** argv )
uint64_t( v["ts"].get<double>() * 1000. ),
v["name"].get<std::string>(),
std::move(zoneText),
false
false,
std::move(locFile),
locLine
} );
}
else if( type == "E" )
@ -225,7 +244,7 @@ int main( int argc, char** argv )
const auto ts0 = uint64_t( v["ts"].get<double>() * 1000. );
const auto ts1 = ts0 + uint64_t( v["dur"].get<double>() * 1000. );
const auto name = v["name"].get<std::string>();
timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts0, name, std::move(zoneText), false } );
timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts0, name, std::move(zoneText), false, std::move(locFile), locLine } );
timeline.emplace_back( tracy::Worker::ImportEventTimeline { tid, ts1, "", "", true } );
}
else if( type == "i" || type == "I" )

View File

@ -3387,14 +3387,21 @@ logo=\bclampe
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,
logo=\bclampe
]{Source locations}
Chrome tracing format doesn't document a way to provide source location data. The \texttt{import-chrome} utility will however recognize a custom \texttt{loc} tag in the root of zone begin events. You should be formatting this data in the usual \texttt{filename:line} style, for example: \texttt{hello.c:42}. Providing the line number (including a colon) is optional, but highly recommended.
\end{bclogo}
\begin{bclogo}[
noborder=true,
couleur=black!5,
logo=\bcattention
]{Limitations}
\begin{itemize}
\item Tracy is a single-process profiler. There is no differentiation between data coming from different pids.
\item Tracy uses thread identifiers assigned by the operating system. This means that no two concurrent threads can have the same tid. Be aware that some external data formats may encourage usage of duplicated thread identifiers.
\item Tracy is a single-process profiler. Should the imported trace contain PID entries, each PID+TID pair will create a new \emph{pseudo-TID} number. If you want to preserve the original TID numbers, your traces should omit PID entries.
\item The imported data may be severely limited, either by not mapping directly to the data structures used by Tracy, or by following undocumented practices.
\end{itemize}
\end{bclogo}

View File

@ -321,8 +321,8 @@ Worker::Worker( const char* name, const char* program, const std::vector<ImportE
SourceLocation srcloc {
StringRef(),
StringRef( StringRef::Idx, StoreString( v.name.c_str(), v.name.size() ).idx ),
StringRef(),
0,
StringRef( StringRef::Idx, StoreString( v.locFile.c_str(), v.locFile.size() ).idx ),
v.locLine,
0
};
int key;

View File

@ -99,6 +99,8 @@ public:
std::string name;
std::string text;
bool isEnd;
std::string locFile;
uint32_t locLine;
};
struct ImportEventMessages