本文整理汇总了C++中HPROF_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ HPROF_ASSERT函数的具体用法?C++ HPROF_ASSERT怎么用?C++ HPROF_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HPROF_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loader_find_or_create
LoaderIndex
loader_find_or_create(JNIEnv *env, jobject loader)
{
LoaderIndex index;
/* See if we remembered the system loader */
if ( loader==NULL && gdata->system_loader != 0 ) {
return gdata->system_loader;
}
if ( loader==NULL ) {
env = NULL;
}
index = search(env, loader);
if ( index == 0 ) {
static LoaderInfo empty_info;
LoaderInfo info;
info = empty_info;
if ( loader != NULL ) {
HPROF_ASSERT(env!=NULL);
info.globalref = newWeakGlobalReference(env, loader);
info.object_index = 0;
}
index = table_create_entry(gdata->loader_table, NULL, 0, (void*)&info);
}
HPROF_ASSERT(search(env,loader)==index);
/* Remember the system loader */
if ( loader==NULL && gdata->system_loader == 0 ) {
gdata->system_loader = index;
}
return index;
}
示例2: blocks_alloc
/* Allocate bytes from a Blocks area. */
void *
blocks_alloc(Blocks *blocks, int nbytes)
{
BlockHeader *block;
int pos;
void *ptr;
HPROF_ASSERT(blocks!=NULL);
HPROF_ASSERT(nbytes>=0);
if ( nbytes == 0 ) {
return NULL;
}
block = blocks->current_block;
nbytes = real_size(blocks->alignment, nbytes);
if ( block == NULL || block->bytes_left < nbytes ) {
add_block(blocks, nbytes);
block = blocks->current_block;
}
pos = block->next_pos;
ptr = (void*)(((char*)block)+pos);
block->next_pos += nbytes;
block->bytes_left -= nbytes;
return ptr;
}
示例3: search_item
static void
search_item(TableIndex index, void *key_ptr, int key_len, void *info_ptr, void *arg)
{
LoaderInfo *info;
SearchData *data;
HPROF_ASSERT(info_ptr!=NULL);
HPROF_ASSERT(arg!=NULL);
info = (LoaderInfo*)info_ptr;
data = (SearchData*)arg;
if ( data->loader == info->globalref ) {
/* Covers when looking for NULL too. */
HPROF_ASSERT(data->found==0); /* Did we find more than one? */
data->found = index;
} else if ( data->env != NULL && data->loader != NULL &&
info->globalref != NULL ) {
jobject lref;
lref = newLocalReference(data->env, info->globalref);
if ( lref == NULL ) {
/* Object went away, free reference and entry */
free_entry(data->env, index);
} else if ( isSameObject(data->env, data->loader, lref) ) {
HPROF_ASSERT(data->found==0); /* Did we find more than one? */
data->found = index;
}
if ( lref != NULL ) {
deleteLocalReference(data->env, lref);
}
}
}
示例4: cbPrimArrayData
/* Primitive array data callback for FollowReferences */
static jint JNICALL
cbPrimArrayData(jlong class_tag, jlong size, jlong* tag_ptr,
jint element_count, jvmtiPrimitiveType element_type,
const void* elements, void* user_data)
{
ObjectIndex object_index;
RefIndex ref_index;
RefIndex prev_ref_index;
HPROF_ASSERT(tag_ptr!=NULL);
HPROF_ASSERT(class_tag!=(jlong)0);
HPROF_ASSERT((*tag_ptr)!=(jlong)0);
if ( class_tag == (jlong)0 || (*tag_ptr) == (jlong)0 ) {
/* We can't do anything with a class_tag==0, just skip it */
return JVMTI_VISIT_OBJECTS;
}
/* Assume object has been tagged, get object index */
object_index = tag_extract((*tag_ptr));
/* Save string data */
prev_ref_index = object_get_references(object_index);
ref_index = reference_prim_array(prev_ref_index,
element_type, elements, element_count);
object_set_references(object_index, ref_index);
return JVMTI_VISIT_OBJECTS;
}
示例5: add_block
/* Add a new current_block to the Blocks* chain, adjust size if nbytes big. */
static void
add_block(Blocks *blocks, int nbytes)
{
int header_size;
int block_size;
BlockHeader *block_header;
HPROF_ASSERT(blocks!=NULL);
HPROF_ASSERT(nbytes>0);
header_size = real_size(blocks->alignment, sizeof(BlockHeader));
block_size = blocks->elem_size*blocks->population;
if ( nbytes > block_size ) {
block_size = real_size(blocks->alignment, nbytes);
}
block_header = (BlockHeader*)HPROF_MALLOC(block_size+header_size);
block_header->next = NULL;
block_header->bytes_left = block_size;
block_header->next_pos = header_size;
/* Link in new block */
if ( blocks->current_block != NULL ) {
blocks->current_block->next = block_header;
}
blocks->current_block = block_header;
if ( blocks->first_block == NULL ) {
blocks->first_block = block_header;
}
}
示例6: stack_object
/* JVMTI callback function. */
static jvmtiIterationControl JNICALL
stack_object(jvmtiHeapRootKind root_kind,
jlong class_tag, jlong size, jlong* tag_ptr,
jlong thread_tag, jint depth, jmethodID method, jint slot,
void *user_data)
{
/* Only calls to Allocate, Deallocate, RawMonitorEnter & RawMonitorExit
* are allowed here (see the JVMTI Spec).
*/
ObjectIndex object_index;
SerialNumber thread_serial_num;
HPROF_ASSERT(tag_ptr!=NULL);
if ( (*tag_ptr) != (jlong)0 ) {
object_index = tag_extract(*tag_ptr);
thread_serial_num = object_get_thread_serial_number(object_index);
thread_serial_num = checkThreadSerialNumber(thread_serial_num);
} else {
SiteIndex site_index;
site_index = site_find_or_create(find_cnum(class_tag),
gdata->system_trace_index);
if ( thread_tag != (jlong)0 ) {
ObjectIndex thread_object_index;
thread_object_index = tag_extract(thread_tag);
thread_serial_num =
object_get_thread_serial_number(thread_object_index);
thread_serial_num = checkThreadSerialNumber(thread_serial_num);
} else {
thread_serial_num = gdata->unknown_thread_serial_num;
}
object_index = object_new(site_index, (jint)size, OBJECT_SYSTEM,
thread_serial_num);
/* Create and set the tag. */
*tag_ptr = tag_create(object_index);
}
HPROF_ASSERT(thread_serial_num!=0);
HPROF_ASSERT(object_index!=0);
switch ( root_kind ) {
case JVMTI_HEAP_ROOT_STACK_LOCAL:
io_heap_root_java_frame(object_index, thread_serial_num, depth);
break;
case JVMTI_HEAP_ROOT_JNI_LOCAL:
io_heap_root_jni_local(object_index, thread_serial_num, depth);
break;
default:
break;
}
return JVMTI_ITERATION_CONTINUE;
}
示例7: get_pkey
static ObjectKey*
get_pkey(ObjectIndex index)
{
void *key_ptr;
int key_len;
table_get_key(gdata->object_table, index, (void*)&key_ptr, &key_len);
HPROF_ASSERT(key_len==(int)sizeof(ObjectKey));
HPROF_ASSERT(key_ptr!=NULL);
return (ObjectKey*)key_ptr;
}
示例8: delete_globalref
static void
delete_globalref(JNIEnv *env, LoaderInfo *info)
{
jobject ref;
HPROF_ASSERT(env!=NULL);
HPROF_ASSERT(info!=NULL);
ref = info->globalref;
info->globalref = NULL;
if ( ref != NULL ) {
deleteWeakGlobalReference(env, ref);
}
info->object_index = 0;
}
示例9: fill_in_field_value
/* Fill in a field value, making sure the index is safe */
static void
fill_in_field_value(RefIndex list, FieldInfo *fields, jvalue *fvalues,
int n_fields, jint index, jvalue value,
jvmtiPrimitiveType primType)
{
HPROF_ASSERT(fvalues != NULL);
HPROF_ASSERT(n_fields > 0);
HPROF_ASSERT(index < n_fields);
HPROF_ASSERT(index >= 0 );
HPROF_ASSERT(fvalues[index].j==(jlong)0);
verify_field(list, fields, fvalues, n_fields, index, value, primType);
if (index >= 0 && index < n_fields) {
fvalues[index] = value;
}
}
示例10: reference_init
void
reference_init(void)
{
HPROF_ASSERT(gdata->reference_table==NULL);
gdata->reference_table = table_initialize("Ref", 2048, 4096, 0,
(int)sizeof(RefInfo));
}
示例11: add_inst_field_to_cmap
/* Add a instance field information to this cmap. */
static void
add_inst_field_to_cmap(CmapInfo *cmap, HprofId id, HprofType ty)
{
int i;
HPROF_ASSERT(cmap!=NULL);
i = cmap->n_finfo++;
if ( i+1 >= cmap->max_finfo ) {
int osize;
Finfo *new_finfo;
osize = cmap->max_finfo;
cmap->max_finfo += 12;
new_finfo = (Finfo*)HPROF_MALLOC(cmap->max_finfo*(int)sizeof(Finfo));
(void)memset(new_finfo,0,cmap->max_finfo*(int)sizeof(Finfo));
if ( i == 0 ) {
cmap->finfo = new_finfo;
} else {
(void)memcpy(new_finfo,cmap->finfo,osize*(int)sizeof(Finfo));
HPROF_FREE(cmap->finfo);
cmap->finfo = new_finfo;
}
}
cmap->finfo[i].id = id;
cmap->finfo[i].ty = ty;
}
示例12: list_item
static void
list_item(TableIndex i, void *key_ptr, int key_len, void *info_ptr, void *arg)
{
FrameKey key;
FrameInfo *info;
HPROF_ASSERT(key_ptr!=NULL);
HPROF_ASSERT(key_len==sizeof(FrameKey));
HPROF_ASSERT(info_ptr!=NULL);
key = *((FrameKey*)key_ptr);
info = (FrameInfo*)info_ptr;
debug_message(
"Frame 0x%08x: method=%p, location=%d, lineno=%d(%d), status=%d \n",
i, (void*)key.method, (jint)key.location,
info->lineno, info->lineno_state, info->status);
}
示例13: get_key_elements
/* Get a void* elements array that was stored as the key. */
static void *
get_key_elements(RefIndex index, jvmtiPrimitiveType primType,
jint *nelements, jint *nbytes)
{
void *key;
jint byteLen;
HPROF_ASSERT(nelements!=NULL);
HPROF_ASSERT(nbytes!=NULL);
table_get_key(gdata->reference_table, index, &key, &byteLen);
HPROF_ASSERT(byteLen>=0);
HPROF_ASSERT(byteLen!=0?key!=NULL:key==NULL);
*nbytes = byteLen;
*nelements = byteLen / get_prim_size(primType);
return key;
}
示例14: blocks_init
/* Initialize a new Blocks */
Blocks *
blocks_init(int alignment, int elem_size, int population)
{
Blocks *blocks;
HPROF_ASSERT(alignment>0);
HPROF_ASSERT(elem_size>0);
HPROF_ASSERT(population>0);
blocks = (Blocks*)HPROF_MALLOC(sizeof(Blocks));
blocks->alignment = alignment;
blocks->elem_size = elem_size;
blocks->population = population;
blocks->first_block = NULL;
blocks->current_block = NULL;
return blocks;
}
示例15: dump_instance_references
static void
dump_instance_references(TableIndex i, void *key_ptr, int key_len, void *info_ptr, void *arg)
{
ObjectInfo *info;
HPROF_ASSERT(info_ptr!=NULL);
info = (ObjectInfo *)info_ptr;
reference_dump_instance((JNIEnv*)arg, i, info->references);
}