Bug 1641704 - vendor tracy-rs 0.1.1 r=gw

Differential Revision: https://phabricator.services.mozilla.com/D77401
This commit is contained in:
Bert Peers 2020-05-29 04:15:29 +00:00
Родитель a4568d4c46
Коммит f41b9eb190
5 изменённых файлов: 22 добавлений и 4 удалений

4
Cargo.lock сгенерированный
Просмотреть файл

@ -5088,9 +5088,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
[[package]]
name = "tracy-rs"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3aa118469b61af5fead107a4882dc4661a05591b6653bbc546c1c8bbc181047"
checksum = "dbbb439715d4c258415c7cbf137be32a4f54f7348724076145ede565ee2142e8"
[[package]]
name = "try-lock"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"1a5ee82b9780670fd91717f2256cea4a2dec911c00d262bf5c53e2c704d50e80","LICENSE":"d82f358a1e02cb205b9a29ada979df5c7a315a29cc73e58f557ae4f33bfd1777","README.md":"c694e1a34230f1b965713ca41df396314025b103cde1acbfc9c168932b59e548","src/disabled.rs":"0f6cd68e22275fd03c0e3c57934f1602700b24806cc1451c4a1ced0ab791ab6b","src/lib.rs":"f6caf42bdb534baa29996e384c79f28b6f462b68cd7ab2bd0f968c28f5612b7a","src/profiler.rs":"bf3673bef9e56dd2d8520cc8b6193036d43a9c3a8e115d3df104c381f4505bec"},"package":"e3aa118469b61af5fead107a4882dc4661a05591b6653bbc546c1c8bbc181047"}
{"files":{"Cargo.toml":"5b7632de436d52dbb8011c64eddaacceda6c6558536820d06b647569802e9f19","LICENSE":"d82f358a1e02cb205b9a29ada979df5c7a315a29cc73e58f557ae4f33bfd1777","README.md":"c694e1a34230f1b965713ca41df396314025b103cde1acbfc9c168932b59e548","src/disabled.rs":"22a64e44ce27656217951a6306e312c4e1288daff8871a426ac07aa13f1408ec","src/lib.rs":"f6caf42bdb534baa29996e384c79f28b6f462b68cd7ab2bd0f968c28f5612b7a","src/profiler.rs":"59992178392aaa09879e4830eaf5f005fe0d24f2163382f56f4df779994f3110"},"package":"dbbb439715d4c258415c7cbf137be32a4f54f7348724076145ede565ee2142e8"}

2
third_party/rust/tracy-rs/Cargo.toml поставляемый
Просмотреть файл

@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "tracy-rs"
version = "0.1.0"
version = "0.1.1"
authors = ["Glenn Watson <git@intuitionlibrary.com>"]
description = "Rust bindings for the tracy realtime profiler"
license = "MPL-2.0"

5
third_party/rust/tracy-rs/src/disabled.rs поставляемый
Просмотреть файл

@ -26,6 +26,11 @@ macro_rules! tracy_end_frame {
($name:expr) => {}
}
#[macro_export]
macro_rules! tracy_plot {
($name:expr, $value:expr) => {}
}
pub unsafe fn load(_: &str) -> bool {
println!("Can't load the tracy profiler unless enable_profiler feature is enabled!");
false

13
third_party/rust/tracy-rs/src/profiler.rs поставляемый
Просмотреть файл

@ -36,6 +36,8 @@ extern "C" fn unimpl_zone_begin(_: *const SourceLocation, _: i32) -> ZoneContext
extern "C" fn unimpl_zone_end(_: ZoneContext) {}
extern "C" fn unimpl_zone_text(_: ZoneContext, _: *const u8, _: usize) {}
extern "C" fn unimpl_plot(_: *const u8, _: f64) {}
// Function pointers to the tracy API functions (if loaded), or the no-op functions above.
pub static mut MARK_FRAME: extern "C" fn(name: *const u8) = unimpl_mark_frame;
pub static mut MARK_FRAME_START: extern "C" fn(name: *const u8) = unimpl_mark_frame_start;
@ -43,6 +45,7 @@ pub static mut MARK_FRAME_END: extern "C" fn(name: *const u8) = unimpl_mark_fram
pub static mut EMIT_ZONE_BEGIN: extern "C" fn(srcloc: *const SourceLocation, active: i32) -> ZoneContext = unimpl_zone_begin;
pub static mut EMIT_ZONE_END: extern "C" fn(ctx: ZoneContext) = unimpl_zone_end;
pub static mut EMIT_ZONE_TEXT: extern "C" fn(ctx: ZoneContext, txt: *const u8, size: usize) = unimpl_zone_text;
pub static mut EMIT_PLOT: extern "C" fn(name: *const u8, val: f64) = unimpl_plot;
// Load the tracy library, and get function pointers. This is unsafe since:
// - It must not be called while other threads are calling the functions.
@ -57,6 +60,7 @@ pub unsafe fn load(path: &str) -> bool {
EMIT_ZONE_BEGIN = lib.sym("___tracy_emit_zone_begin\0").unwrap();
EMIT_ZONE_END = lib.sym("___tracy_emit_zone_end\0").unwrap();
EMIT_ZONE_TEXT = lib.sym("___tracy_emit_zone_text\0").unwrap();
EMIT_PLOT = lib.sym("___tracy_emit_plot\0").unwrap();
true
}
@ -137,6 +141,15 @@ macro_rules! tracy_end_frame {
}
}
#[macro_export]
macro_rules! tracy_plot {
($name:expr, $value:expr) => {
unsafe {
$crate::profiler::EMIT_PLOT(concat!($name, "\0").as_ptr(), $value)
}
}
}
// Provide a name for this thread to the profiler
pub fn register_thread_with_profiler(_: String) {
// TODO(gw): Add support for passing this to the tracy api