1/* 2 * Copyright (c) 2011 Apple Inc. All rights reserved. 3 * 4 * @APPLE_APACHE_LICENSE_HEADER_START@ 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * @APPLE_APACHE_LICENSE_HEADER_END@ 19 */ 20/* 21 auto_trace.d 22 DTrace support. 23 Copyright (c) 2006-2011 Apple Inc. All rights reserved. 24 */ 25 26// First define malloc_zone_t's 27//#include <malloc/malloc.h> // don't include directly <rdar://problem/7823490> 28struct _malloc_zone_t; 29typedef struct _malloc_zone_t malloc_zone_t; 30 31// Don't actually let "auto_zone.h" be included becuase it would bring in <sys/types>; 32// An auto_zone_t is typedef'd to a malloc_zone_t anyways. 33#define __AUTO_ZONE__ 34#define auto_zone_t malloc_zone_t 35 36// Include the collection_phase_t flags 37//#include <stdint.h> 38//#include "auto_trace.h" 39 40typedef enum { 41 AUTO_TRACE_SCANNING_PHASE = 0, 42 AUTO_TRACE_WEAK_REFERENCE_PHASE, 43 AUTO_TRACE_FINALIZING_PHASE, 44 AUTO_TRACE_SCAVENGING_PHASE 45} auto_collection_phase_t; 46 47typedef enum { 48 AUTO_TRACE_FULL = 0, 49 AUTO_TRACE_GENERATIONAL = 1, 50 AUTO_TRACE_LOCAL = 2 51} auto_collection_type_t; 52 53provider garbage_collection { 54 probe collection_begin(auto_zone_t *zone, auto_collection_type_t collection_type); 55 probe collection_end(auto_zone_t *zone, uint64_t objects_reclaimed, uint64_t bytes_reclaimed, uint64_t total_objects_in_use, uint64_t total_bytes_in_use); 56 57 probe collection_phase_begin(auto_zone_t *zone, auto_collection_phase_t phase); 58 probe collection_phase_end(auto_zone_t *zone, auto_collection_phase_t phase, uint64_t number_affected, uint64_t bytes_affected); 59 probe auto_refcount_one_allocation(uint64_t size); 60 probe auto_block_lost_thread_locality(void *block, uint64_t size); 61}; 62