2018-06-12 11:29:39 +08:00
|
|
|
//===-- xray_profiling_flags.inc --------------------------------*- C++ -*-===//
|
2018-05-15 08:42:36 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-05-15 08:42:36 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// XRay profiling runtime flags.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef XRAY_FLAG
|
|
|
|
#error "Define XRAY_FLAG prior to including this file!"
|
|
|
|
#endif
|
|
|
|
|
[XRay] Use preallocated memory for XRay profiling
Summary:
This change builds upon D54989, which removes memory allocation from the
critical path of the profiling implementation. This also changes the API
for the profile collection service, to take ownership of the memory and
associated data structures per-thread.
The consolidation of the memory allocation allows us to do two things:
- Limits the amount of memory used by the profiling implementation,
associating preallocated buffers instead of allocating memory
on-demand.
- Consolidate the memory initialisation and cleanup by relying on the
buffer queue's reference counting implementation.
We find a number of places which also display some problematic
behaviour, including:
- Off-by-factor bug in the allocator implementation.
- Unrolling semantics in cases of "memory exhausted" situations, when
managing the state of the function call trie.
We also add a few test cases which verify our understanding of the
behaviour of the system, with important edge-cases (especially for
memory-exhausted cases) in the segmented array and profile collector
unit tests.
Depends on D54989.
Reviewers: mboerger
Subscribers: dschuff, mgorny, dmgreen, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D55249
llvm-svn: 348568
2018-12-07 14:23:06 +08:00
|
|
|
XRAY_FLAG(uptr, per_thread_allocator_max, 16384,
|
2018-05-15 08:42:36 +08:00
|
|
|
"Maximum size of any single per-thread allocator.")
|
|
|
|
XRAY_FLAG(uptr, global_allocator_max, 2 << 24,
|
|
|
|
"Maximum size of the global allocator for profile storage.")
|
2018-07-18 09:53:39 +08:00
|
|
|
XRAY_FLAG(uptr, stack_allocator_max, 2 << 20,
|
2018-05-15 08:42:36 +08:00
|
|
|
"Maximum size of the traversal stack allocator.")
|
2018-07-13 12:04:18 +08:00
|
|
|
XRAY_FLAG(int, grace_period_ms, 1,
|
2018-05-15 08:42:36 +08:00
|
|
|
"Profile collection will wait this much time in milliseconds before "
|
|
|
|
"resetting the global state. This gives a chance to threads to "
|
|
|
|
"notice that the profiler has been finalized and clean up.")
|
2018-06-12 12:06:25 +08:00
|
|
|
XRAY_FLAG(bool, no_flush, false,
|
|
|
|
"Set to true if we want the profiling implementation to not write "
|
|
|
|
"out files.")
|
[XRay] Use preallocated memory for XRay profiling
Summary:
This change builds upon D54989, which removes memory allocation from the
critical path of the profiling implementation. This also changes the API
for the profile collection service, to take ownership of the memory and
associated data structures per-thread.
The consolidation of the memory allocation allows us to do two things:
- Limits the amount of memory used by the profiling implementation,
associating preallocated buffers instead of allocating memory
on-demand.
- Consolidate the memory initialisation and cleanup by relying on the
buffer queue's reference counting implementation.
We find a number of places which also display some problematic
behaviour, including:
- Off-by-factor bug in the allocator implementation.
- Unrolling semantics in cases of "memory exhausted" situations, when
managing the state of the function call trie.
We also add a few test cases which verify our understanding of the
behaviour of the system, with important edge-cases (especially for
memory-exhausted cases) in the segmented array and profile collector
unit tests.
Depends on D54989.
Reviewers: mboerger
Subscribers: dschuff, mgorny, dmgreen, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D55249
llvm-svn: 348568
2018-12-07 14:23:06 +08:00
|
|
|
XRAY_FLAG(int, buffers_max, 128,
|
|
|
|
"The number of buffers to pre-allocate used by the profiling "
|
|
|
|
"implementation.")
|