Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: base/allocator/allocator_extension.h

Issue 10825250: Expose memory allocator internal stats and properties. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add jemalloc.h include Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/allocator/allocator.gyp ('k') | base/allocator/allocator_extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H 5 #ifndef BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H
6 #define BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H 6 #define BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H
7 7
8 #include <stddef.h> // for size_t
9
8 #include "base/allocator/allocator_extension_thunks.h" 10 #include "base/allocator/allocator_extension_thunks.h"
9 #include "base/base_export.h" 11 #include "base/base_export.h"
10 #include "build/build_config.h" 12 #include "build/build_config.h"
11 13
12 namespace base { 14 namespace base {
13 namespace allocator { 15 namespace allocator {
14 16
17 // Request the allocator to report value of its internal state variable.
18 //
19 // |name| name of the variable
20 // |value| pointer to the returned value, must be not NULL.
21 // Returns true if the value has been returned, false if a variable with such
22 // name does not exist.
23 BASE_EXPORT bool GetProperty(const char* name, size_t* value);
24
15 // Request that the allocator print a human-readable description of the current 25 // Request that the allocator print a human-readable description of the current
16 // state of the allocator into a null-terminated string in the memory segment 26 // state of the allocator into a null-terminated string in the memory segment
17 // buffer[0,buffer_length-1]. 27 // buffer[0,buffer_length-1].
18 // 28 //
19 // |buffer| must point to a valid piece of memory 29 // |buffer| must point to a valid piece of memory
20 // |buffer_length| must be > 0. 30 // |buffer_length| must be > 0.
21 BASE_EXPORT void GetStats(char* buffer, int buffer_length); 31 BASE_EXPORT void GetStats(char* buffer, int buffer_length);
22 32
23 // Request that the allocator release any free memory it knows about to the 33 // Request that the allocator release any free memory it knows about to the
24 // system. 34 // system.
25 BASE_EXPORT void ReleaseFreeMemory(); 35 BASE_EXPORT void ReleaseFreeMemory();
26 36
27 37
28 // These settings allow specifying a callback used to implement the allocator 38 // These settings allow specifying a callback used to implement the allocator
29 // extension functions. These are optional, but if set they must only be set 39 // extension functions. These are optional, but if set they must only be set
30 // once. These will typically called in an allocator-specific initialization 40 // once. These will typically called in an allocator-specific initialization
31 // routine. 41 // routine.
32 // 42 //
33 // No threading promises are made. The caller is responsible for making sure 43 // No threading promises are made. The caller is responsible for making sure
34 // these pointers are set before any other threads attempt to call the above 44 // these pointers are set before any other threads attempt to call the above
35 // functions. 45 // functions.
46 BASE_EXPORT void SetGetPropertyFunction(
47 thunks::GetPropertyFunction get_property_function);
48
36 BASE_EXPORT void SetGetStatsFunction( 49 BASE_EXPORT void SetGetStatsFunction(
37 thunks::GetStatsFunction* get_stats_function); 50 thunks::GetStatsFunction get_stats_function);
38 51
39 BASE_EXPORT void SetReleaseFreeMemoryFunction( 52 BASE_EXPORT void SetReleaseFreeMemoryFunction(
40 thunks::ReleaseFreeMemoryFunction* release_free_memory_function); 53 thunks::ReleaseFreeMemoryFunction release_free_memory_function);
54
41 } // namespace allocator 55 } // namespace allocator
42 } // namespace base 56 } // namespace base
43 57
44 #endif 58 #endif
OLDNEW
« no previous file with comments | « base/allocator/allocator.gyp ('k') | base/allocator/allocator_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698