History

Enable logging from exec for specific components. Remove trailing newlines from all existing logging calls.

arr committed 9 years ago

Commit dd0789c1 parent 3098fb816 files · +185 −112Browse files

Showing the changes to src/vm/garbage_collector.cpp (1 of 16 files). Show all

Unified · Split

src/vm/garbage_collector.cpp+7−7
@@ -93,7 +93,7 @@ void default_garbage_collector_t::track_allocation(vm_alloc_t *alloc) · 92 unmodified lines
93 assert(alloc != nullptr);93 assert(alloc != nullptr);
94 94
95 if (debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>())95 if (debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>())
96 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: track: %#" PRIxPTR "\n", alloc);96 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: track: %#" PRIxPTR, alloc);
97 97
98 alloc->add_ref();98 alloc->add_ref();
99 set_gc_colour(alloc, get_current_colour(_collection_epoch));99 set_gc_colour(alloc, get_current_colour(_collection_epoch));
@@ -152,13 +152,13 @@ namespace · 52 unmodified lines
152 const auto log_enabled = debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>();152 const auto log_enabled = debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>();
153 if (log_enabled)153 if (log_enabled)
154 {154 {
155 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: roots found: %" PRIuPTR "\n", allocs.size());155 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: roots found: %" PRIuPTR, allocs.size());
156 156
157 // If logging is enabled update the callback with logging157 // If logging is enabled update the callback with logging
158 add_pointer_to_queue = std::function<void(pointer_t p, std::size_t)>{ [&allocs](pointer_t p, std::size_t) -> void158 add_pointer_to_queue = std::function<void(pointer_t p, std::size_t)>{ [&allocs](pointer_t p, std::size_t) -> void
159 {159 {
160 auto a = vm_alloc_t::from_allocation(p);160 auto a = vm_alloc_t::from_allocation(p);
161 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, " ref: %#" PRIxPTR "\n", a);161 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, " ref: %#" PRIxPTR, a);
162 allocs.push(a);162 allocs.push(a);
163 } };163 } };
164 }164 }
@@ -170,7 +170,7 @@ namespace · 5 unmodified lines
170 allocs.pop();170 allocs.pop();
171 171
172 if (log_enabled)172 if (log_enabled)
173 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: mark: alloc: %#" PRIxPTR "\n", curr);173 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: mark: alloc: %#" PRIxPTR, curr);
174 174
175 if (curr->alloc_type->map_in_bytes > 0)175 if (curr->alloc_type->map_in_bytes > 0)
176 enum_pointer_fields(*curr->alloc_type, curr->get_allocation(), add_pointer_to_queue);176 enum_pointer_fields(*curr->alloc_type, curr->get_allocation(), add_pointer_to_queue);
@@ -198,7 +198,7 @@ namespace · 21 unmodified lines
198 }198 }
199 199
200 if (debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>())200 if (debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>())
201 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: sweep: %u\n", freed);201 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: sweep: %u", freed);
202 }202 }
203}203}
204 204
@@ -213,7 +213,7 @@ bool default_garbage_collector_t::collect(std::vector<std::shared_ptr<const vm_t · 8 unmodified lines
213 213
214 const auto log_enabled = debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>();214 const auto log_enabled = debug::is_component_tracing_enabled<debug::component_trace_t::garbage_collector>();
215 if (log_enabled)215 if (log_enabled)
216 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: begin: collect\n");216 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: begin: collect");
217 217
218 const auto curr_colour = get_current_colour(_collection_epoch);218 const auto curr_colour = get_current_colour(_collection_epoch);
219 mark(threads, curr_colour);219 mark(threads, curr_colour);
@@ -222,7 +222,7 @@ bool default_garbage_collector_t::collect(std::vector<std::shared_ptr<const vm_t · 2 unmodified lines
222 sweep(_tracking_allocs, sweeper_colour);222 sweep(_tracking_allocs, sweeper_colour);
223 223
224 if (log_enabled)224 if (log_enabled)
225 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: end: collect\n");225 debug::log_msg(debug::component_trace_t::garbage_collector, debug::log_level_t::debug, "gc: end: collect");
226 226
227 ++_collection_epoch;227 ++_collection_epoch;
228 return true;228 return true;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t