feat(profiling)!: expose missing API in CXX - #2497
Conversation
📚 Documentation Check Results📦
|
| // NOTE: api2's Rust/C FFI datatype uses file_name, while pprof and | ||
| // the string-based CXX Function use filename. Keep file_name for now | ||
| // to match api2; revisit the CXX-facing name during PR review. | ||
| file_name: StringId2, |
There was a problem hiding this comment.
Anyone have any thoughts here?
🔒 Cargo Deny Results📦
|
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: bb7ab76 | Docs | View more details | Give us feedback! |
| // SAFETY: all ids come from the profile's dictionary. | ||
| black_box(unsafe { | ||
| profile.try_add_sample2(&locations, &values, labels_iter, None) | ||
| profile.try_add_sample2(locations.iter().copied(), &values, labels_iter, None) |
There was a problem hiding this comment.
Why did this have to change, by the way? I assume it's because &[Location] doesn't implement an iterator, but rather IntoIterator?
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7aeac76d76
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| fn create_with_dictionary( | ||
| sample_types: Vec<SampleType>, | ||
| period: &Period, | ||
| dictionary: &ProfilesDictionary, | ||
| ) -> Result<Box<Profile>>; |
There was a problem hiding this comment.
Provide a no-period dictionary profile constructor
Dictionary-backed CXX profiles now require a Period, so consumers of the existing Profile::create_no_period path cannot migrate to add_sample2; supplying a dummy period changes the serialized pprof by emitting period fields. The internal try_new_with_dictionary and C FFI dictionary constructor both support None, so expose an equivalent dictionary-backed no-period factory here.
Useful? React with 👍 / 👎.
BenchmarksComparisonBenchmark execution time: 2026-09-10 20:28:56 Comparing candidate commit bb7ab76 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 13 metrics, 0 unstable metrics.
|
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | bb7ab76 | 1789071525 | better-cxx |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profiles_dictionary/profile_string_inserts/threads/1 | execution_time | 374.306µs | 375.407µs ± 0.877µs | 375.219µs ± 0.604µs | 375.944µs | 376.755µs | 376.815µs | 376.830µs | 0.43% | 0.430 | -1.019 | 0.22% | 0.277µs | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/1 | throughput | 2717402.651op/s | 2727717.006op/s ± 6366.589op/s | 2729070.565op/s ± 4403.500op/s | 2731513.405op/s | 2735475.402op/s | 2735681.362op/s | 2735732.852op/s | 0.24% | -0.424 | -1.021 | 0.22% | 2013.292op/s | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/16 | execution_time | 1.989ms | 2.001ms ± 0.005ms | 2.002ms ± 0.003ms | 2.003ms | 2.006ms | 2.007ms | 2.007ms | 0.27% | -1.143 | 1.084 | 0.24% | 0.002ms | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/16 | throughput | 8162765.196op/s | 8189930.994op/s ± 21162.055op/s | 8184982.677op/s ± 12194.106op/s | 8198383.151op/s | 8221844.454op/s | 8235839.831op/s | 8239338.675op/s | 0.66% | 1.156 | 1.109 | 0.25% | 6692.029op/s | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/2 | execution_time | 635.919µs | 639.286µs ± 3.136µs | 638.742µs ± 1.429µs | 639.729µs | 644.725µs | 644.976µs | 645.038µs | 0.99% | 0.888 | -0.434 | 0.47% | 0.992µs | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/2 | throughput | 3175005.395op/s | 3203641.956op/s ± 15652.119op/s | 3206300.735op/s ± 7180.489op/s | 3214092.297op/s | 3220093.251op/s | 3220447.671op/s | 3220536.276op/s | 0.44% | -0.877 | -0.445 | 0.46% | 4949.635op/s | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/4 | execution_time | 814.065µs | 817.919µs ± 3.567µs | 817.132µs ± 2.652µs | 820.490µs | 823.165µs | 823.460µs | 823.533µs | 0.78% | 0.395 | -1.355 | 0.41% | 1.128µs | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/4 | throughput | 4973691.562op/s | 5007917.371op/s ± 21803.487op/s | 5012655.987op/s ± 16268.677op/s | 5027812.025op/s | 5030248.012op/s | 5031282.282op/s | 5031540.849op/s | 0.38% | -0.389 | -1.362 | 0.41% | 6894.868op/s | 1 | 10 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profiles_dictionary/profile_string_inserts/threads/1 | execution_time | [374.864µs; 375.951µs] or [-0.145%; +0.145%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/1 | throughput | [2723771.025op/s; 2731662.986op/s] or [-0.145%; +0.145%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/16 | execution_time | [1.997ms; 2.004ms] or [-0.160%; +0.160%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/16 | throughput | [8176814.857op/s; 8203047.130op/s] or [-0.160%; +0.160%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/2 | execution_time | [637.342µs; 641.230µs] or [-0.304%; +0.304%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/2 | throughput | [3193940.850op/s; 3213343.061op/s] or [-0.303%; +0.303%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/4 | execution_time | [815.708µs; 820.130µs] or [-0.270%; +0.270%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/4 | throughput | [4994403.678op/s; 5021431.064op/s] or [-0.270%; +0.270%] | None | None | None |
Group 2
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | bb7ab76 | 1789071525 | better-cxx |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_add_sample_timestamped_x1000 | execution_time | 4.050ms | 4.056ms ± 0.009ms | 4.055ms ± 0.001ms | 4.056ms | 4.059ms | 4.062ms | 4.176ms | 3.00% | 12.076 | 157.210 | 0.22% | 0.001ms | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_add_sample_timestamped_x1000 | execution_time | [4.054ms; 4.057ms] or [-0.031%; +0.031%] | None | None | None |
Group 3
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | bb7ab76 | 1789071525 | better-cxx |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| benching string interning on wordpress profile | execution_time | 123.703µs | 124.813µs ± 0.468µs | 124.741µs ± 0.141µs | 124.898µs | 125.374µs | 126.467µs | 128.915µs | 3.35% | 4.147 | 31.231 | 0.37% | 0.033µs | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| benching string interning on wordpress profile | execution_time | [124.748µs; 124.878µs] or [-0.052%; +0.052%] | None | None | None |
Group 4
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | bb7ab76 | 1789071525 | better-cxx |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_serialize_compressed_pprof_timestamped_x1000 | execution_time | 953.238µs | 957.056µs ± 2.692µs | 956.468µs ± 0.818µs | 957.379µs | 961.650µs | 963.923µs | 980.184µs | 2.48% | 3.969 | 27.178 | 0.28% | 0.190µs | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_serialize_compressed_pprof_timestamped_x1000 | execution_time | [956.683µs; 957.429µs] or [-0.039%; +0.039%] | None | None | None |
Group 5
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | bb7ab76 | 1789071525 | better-cxx |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_add_sample_frames_x1000 | execution_time | 4.098ms | 4.104ms ± 0.003ms | 4.104ms ± 0.001ms | 4.105ms | 4.108ms | 4.109ms | 4.131ms | 0.67% | 4.218 | 34.686 | 0.07% | 0.000ms | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_add_sample_frames_x1000 | execution_time | [4.104ms; 4.104ms] or [-0.010%; +0.010%] | None | None | None |
Group 6
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | bb7ab76 | 1789071525 | better-cxx |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_add_sample2_frames_x1000 | execution_time | 688.298µs | 689.652µs ± 0.491µs | 689.654µs ± 0.314µs | 689.974µs | 690.466µs | 690.751µs | 691.267µs | 0.23% | 0.012 | 0.136 | 0.07% | 0.035µs | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_add_sample2_frames_x1000 | execution_time | [689.584µs; 689.720µs] or [-0.010%; +0.010%] | None | None | None |
Baseline
Baseline benchmark details
Group 1
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | 8b0fa65 | 1789070470 | main |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profiles_dictionary/profile_string_inserts/threads/1 | execution_time | 377.829µs | 379.411µs ± 1.215µs | 379.461µs ± 0.453µs | 379.699µs | 381.211µs | 382.051µs | 382.261µs | 0.74% | 1.123 | 1.224 | 0.30% | 0.384µs | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/1 | throughput | 2678796.696op/s | 2698947.019op/s ± 8614.571op/s | 2698565.431op/s ± 3221.426op/s | 2704517.744op/s | 2708687.729op/s | 2709913.327op/s | 2710219.727op/s | 0.43% | -1.105 | 1.190 | 0.30% | 2724.167op/s | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/16 | execution_time | 1.992ms | 1.998ms ± 0.006ms | 1.995ms ± 0.002ms | 2.002ms | 2.007ms | 2.009ms | 2.010ms | 0.76% | 0.875 | -0.523 | 0.29% | 0.002ms | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/16 | throughput | 8151617.328op/s | 8200937.774op/s ± 24612.006op/s | 8213270.871op/s ± 10299.676op/s | 8218355.862op/s | 8223596.670op/s | 8223784.757op/s | 8223831.778op/s | 0.13% | -0.869 | -0.537 | 0.28% | 7783.000op/s | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/2 | execution_time | 633.227µs | 636.033µs ± 3.356µs | 634.423µs ± 1.049µs | 636.984µs | 641.973µs | 642.005µs | 642.014µs | 1.20% | 1.098 | -0.424 | 0.50% | 1.061µs | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/2 | throughput | 3189963.439op/s | 3220040.175op/s ± 16899.659op/s | 3228130.623op/s ± 5337.850op/s | 3231005.222op/s | 3233643.651op/s | 3234111.949op/s | 3234229.023op/s | 0.19% | -1.092 | -0.434 | 0.50% | 5344.141op/s | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/4 | execution_time | 815.122µs | 824.131µs ± 5.371µs | 824.284µs ± 2.503µs | 825.760µs | 831.924µs | 835.074µs | 835.862µs | 1.40% | 0.628 | 0.845 | 0.62% | 1.698µs | 1 | 10 |
| profiles_dictionary/profile_string_inserts/threads/4 | throughput | 4900329.649op/s | 4970275.275op/s ± 32268.459op/s | 4969160.750op/s ± 15080.510op/s | 4987354.310op/s | 5010214.911op/s | 5022054.976op/s | 5025014.992op/s | 1.12% | -0.582 | 0.805 | 0.62% | 10204.183op/s | 1 | 10 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profiles_dictionary/profile_string_inserts/threads/1 | execution_time | [378.658µs; 380.164µs] or [-0.198%; +0.198%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/1 | throughput | [2693607.750op/s; 2704286.287op/s] or [-0.198%; +0.198%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/16 | execution_time | [1.994ms; 2.002ms] or [-0.186%; +0.186%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/16 | throughput | [8185683.375op/s; 8216192.174op/s] or [-0.186%; +0.186%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/2 | execution_time | [633.953µs; 638.113µs] or [-0.327%; +0.327%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/2 | throughput | [3209565.851op/s; 3230514.500op/s] or [-0.325%; +0.325%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/4 | execution_time | [820.802µs; 827.459µs] or [-0.404%; +0.404%] | None | None | None |
| profiles_dictionary/profile_string_inserts/threads/4 | throughput | [4950275.444op/s; 4990275.105op/s] or [-0.402%; +0.402%] | None | None | None |
Group 2
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | 8b0fa65 | 1789070470 | main |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_add_sample_timestamped_x1000 | execution_time | 4.003ms | 4.010ms ± 0.009ms | 4.009ms ± 0.002ms | 4.011ms | 4.014ms | 4.016ms | 4.134ms | 3.12% | 12.100 | 158.771 | 0.23% | 0.001ms | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_add_sample_timestamped_x1000 | execution_time | [4.009ms; 4.011ms] or [-0.032%; +0.032%] | None | None | None |
Group 3
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | 8b0fa65 | 1789070470 | main |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| benching string interning on wordpress profile | execution_time | 124.693µs | 125.764µs ± 0.351µs | 125.740µs ± 0.171µs | 125.914µs | 126.239µs | 126.725µs | 127.683µs | 1.55% | 1.432 | 8.315 | 0.28% | 0.025µs | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| benching string interning on wordpress profile | execution_time | [125.716µs; 125.813µs] or [-0.039%; +0.039%] | None | None | None |
Group 4
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | 8b0fa65 | 1789070470 | main |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_serialize_compressed_pprof_timestamped_x1000 | execution_time | 934.759µs | 937.933µs ± 2.100µs | 937.419µs ± 0.889µs | 938.432µs | 941.713µs | 944.371µs | 951.152µs | 1.46% | 2.046 | 7.532 | 0.22% | 0.148µs | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_serialize_compressed_pprof_timestamped_x1000 | execution_time | [937.642µs; 938.224µs] or [-0.031%; +0.031%] | None | None | None |
Group 5
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | 8b0fa65 | 1789070470 | main |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_add_sample_frames_x1000 | execution_time | 4.006ms | 4.014ms ± 0.002ms | 4.014ms ± 0.002ms | 4.016ms | 4.018ms | 4.020ms | 4.021ms | 0.17% | -0.205 | 0.381 | 0.06% | 0.000ms | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_add_sample_frames_x1000 | execution_time | [4.014ms; 4.014ms] or [-0.009%; +0.009%] | None | None | None |
Group 6
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz | 8b0fa65 | 1789070470 | main |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| profile_add_sample2_frames_x1000 | execution_time | 712.829µs | 714.374µs ± 0.620µs | 714.354µs ± 0.416µs | 714.777µs | 715.408µs | 715.854µs | 716.604µs | 0.31% | 0.280 | 0.376 | 0.09% | 0.044µs | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| profile_add_sample2_frames_x1000 | execution_time | [714.288µs; 714.460µs] or [-0.012%; +0.012%] | None | None | None |
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
ekump
left a comment
There was a problem hiding this comment.
LGTM for the AGENTS.md change
There was a problem hiding this comment.
I'm not sure why this file needs to be updated as a part of this PR.
| /// borrowed only for the duration of this call. endtime_ns is an | ||
| /// optional end timestamp in nanoseconds; pass 0 to record the sample | ||
| /// without a timestamp. | ||
| fn add_sample2(self: &mut Profile, sample: &Sample2, endtime_ns: i64) -> Status; |
There was a problem hiding this comment.
Since libdd_profiling::cxx::ffi is not intended for Rust callers, please make the bridge module and its Rust implementation surface crate-private. The current public visibility accidentally exposes an unsound safe API to downstream Rust, as demonstrated by this reproducer (https://gist.github.com/taegyunkim/8d0b2ff9fe8e95262299fd7ad40c3a1f), which uses #![forbid(unsafe_code)] but still segfaults through add_sample2.
There was a problem hiding this comment.
Can this also be tested in CI by adding it to .github/workflows/test-ffi.yml?
What does this PR do?
Updates the CXX API to expose APIs for
Motivation
I would like to use this API for Python, but currently we're missing this functionality so we have to use the old C api.
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.