PageRenderTime 26ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcommon/llallocator_heap_profile.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 71 lines | 32 code | 13 blank | 26 comment | 0 complexity | b2e653726020e25eabf5fc154a2a3bee MD5 | raw file
 1/** 
 2 * @file llallocator_heap_profile.h
 3 * @brief Declaration of the parser for tcmalloc heap profile data.
 4 * @author Brad Kittenbrink
 5 *
 6 * $LicenseInfo:firstyear=2009&license=viewerlgpl$
 7 * Second Life Viewer Source Code
 8 * Copyright (C) 2010, Linden Research, Inc.
 9 * 
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation;
13 * version 2.1 of the License only.
14 * 
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 * 
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 * 
24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
25 * $/LicenseInfo$
26 */
27
28#ifndef LL_LLALLOCATOR_HEAP_PROFILE_H
29#define LL_LLALLOCATOR_HEAP_PROFILE_H
30
31#include "stdtypes.h"
32
33#include <map>
34#include <vector>
35
36class LLAllocatorHeapProfile
37{
38public:
39    typedef int stack_marker;
40
41    typedef std::vector<stack_marker> stack_trace;
42
43    struct line {
44        line(U32 live_count, U64 live_size, U32 tot_count, U64 tot_size) :
45            mLiveSize(live_size),
46            mTotalSize(tot_size),
47            mLiveCount(live_count),
48            mTotalCount(tot_count)
49        {
50        }
51        U64 mLiveSize, mTotalSize;
52        U32 mLiveCount, mTotalCount;
53        stack_trace mTrace;
54    };
55
56    typedef std::vector<line> lines_t;
57
58    LLAllocatorHeapProfile()
59    {
60    }
61
62	void parse(std::string const & prof_text);
63
64    void dump(std::ostream & out) const;
65
66public:
67    lines_t mLines;
68};
69
70
71#endif // LL_LLALLOCATOR_HEAP_PROFILE_H