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

Side by Side Diff: third_party/tcmalloc/chromium/src/sampler.h

Issue 7050034: Merge google-perftools r109 (the current contents of third_party/tcmalloc/vendor) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 29
30 // --- 30 // ---
31 // All Rights Reserved. 31 // All Rights Reserved.
32 // 32 //
33 // Author: Daniel Ford 33 // Author: Daniel Ford
34 34
35 #ifndef TCMALLOC_SAMPLER_H_ 35 #ifndef TCMALLOC_SAMPLER_H_
36 #define TCMALLOC_SAMPLER_H_ 36 #define TCMALLOC_SAMPLER_H_
37 37
38 #include "config.h" 38 #include "config.h"
39 #include "common.h" 39 #include <stddef.h> // for size_t
40 #include "static_vars.h" 40 #ifdef HAVE_STDINT_H
41 #include <stdint.h> // for uint64_t, uint32_t, int32_t
42 #endif
43 #include <string.h> // for memcpy
44 #include "base/basictypes.h" // for ASSERT
45 #include "internal_logging.h" // for ASSERT
41 46
42 namespace tcmalloc { 47 namespace tcmalloc {
43 48
44 //------------------------------------------------------------------- 49 //-------------------------------------------------------------------
45 // Sampler to decide when to create a sample trace for an allocation 50 // Sampler to decide when to create a sample trace for an allocation
46 // Not thread safe: Each thread should have it's own sampler object. 51 // Not thread safe: Each thread should have it's own sampler object.
47 // Caller must use external synchronization if used 52 // Caller must use external synchronization if used
48 // from multiple threads. 53 // from multiple threads.
49 // 54 //
50 // With 512K average sample step (the default): 55 // With 512K average sample step (the default):
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 memcpy(&x, &d, sizeof(x)); // we depend on the compiler inlining this 170 memcpy(&x, &d, sizeof(x)); // we depend on the compiler inlining this
166 const uint32_t x_high = x >> 32; 171 const uint32_t x_high = x >> 32;
167 const uint32_t y = x_high >> (20 - kFastlogNumBits) & kFastlogMask; 172 const uint32_t y = x_high >> (20 - kFastlogNumBits) & kFastlogMask;
168 const int32_t exponent = ((x_high >> 20) & 0x7FF) - 1023; 173 const int32_t exponent = ((x_high >> 20) & 0x7FF) - 1023;
169 return exponent + log_table_[y]; 174 return exponent + log_table_[y];
170 } 175 }
171 176
172 } // namespace tcmalloc 177 } // namespace tcmalloc
173 178
174 #endif // TCMALLOC_SAMPLER_H_ 179 #endif // TCMALLOC_SAMPLER_H_
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/raw_printer.cc ('k') | third_party/tcmalloc/chromium/src/sampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698