space.cc revision 02c8cc6d1312a2b55533f02f6369dc7c94672f90
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "space.h"
18
19#include "base/logging.h"
20
21namespace art {
22namespace gc {
23namespace space {
24
25Space::Space(const std::string& name, GcRetentionPolicy gc_retention_policy)
26    : name_(name), gc_retention_policy_(gc_retention_policy) { }
27
28void Space::Dump(std::ostream& os) const {
29  os << GetName() << ":" << GetGcRetentionPolicy();
30}
31
32std::ostream& operator<<(std::ostream& os, const Space& space) {
33  space.Dump(os);
34  return os;
35}
36
37
38DiscontinuousSpace::DiscontinuousSpace(const std::string& name,
39                                       GcRetentionPolicy gc_retention_policy) :
40    Space(name, gc_retention_policy),
41    live_objects_(new accounting::SpaceSetMap("large live objects")),
42    mark_objects_(new accounting::SpaceSetMap("large marked objects")) {
43}
44
45}  // namespace space
46}  // namespace gc
47}  // namespace art
48