コード例 #1
0
void xml_help_for_event(struct op_event const * event)
{
	uint i;
	int nr_counters;
	int has_nested = strcmp(event->unit->name, "zero");
	char buffer[MAX_BUFFER];

	buffer[0] = '\0';
	open_xml_element(HELP_EVENT, 1, buffer);
	init_xml_str_attr(HELP_EVENT_NAME, event->name, buffer);
	xml_do_arch_specific_event_help(event, buffer);
	init_xml_str_attr(HELP_EVENT_DESC, event->desc, buffer);

	nr_counters = op_get_nr_counters(cpu_type);
	init_xml_int_attr(HELP_COUNTER_MASK, event->counter_mask, buffer);
	init_xml_int_attr(HELP_MIN_COUNT, event->min_count, buffer);

	if (has_nested) {
		close_xml_element(NONE, 1, buffer);
		open_xml_element(HELP_UNIT_MASKS, 1, buffer);
		init_xml_int_attr(HELP_DEFAULT_MASK, event->unit->default_mask, buffer);
		close_xml_element(NONE, 1, buffer);
		for (i = 0; i < event->unit->num; i++) {
			open_xml_element(HELP_UNIT_MASK, 1, buffer);
			init_xml_int_attr(HELP_UNIT_MASK_VALUE,
					  event->unit->um[i].value, buffer);
			init_xml_str_attr(HELP_UNIT_MASK_DESC,
					  event->unit->um[i].desc, buffer);
			close_xml_element(NONE, 0, buffer);
		}
		close_xml_element(HELP_UNIT_MASKS, 0, buffer);
	}
	close_xml_element(has_nested ? HELP_EVENT : NONE, has_nested, buffer);
	printf("%s", buffer);
}
コード例 #2
0
ファイル: op_xml_events.c プロジェクト: deztructor/oprofile-1
void xml_help_for_event(struct op_event const * event)
{
	uint i;
	int has_nested = strcmp(event->unit->name, "zero");

	buffer[0] = '\0';
	open_xml_element(HELP_EVENT, 1, buffer, MAX_BUFFER);
	init_xml_str_attr(HELP_EVENT_NAME, event->name, buffer, MAX_BUFFER);
	xml_do_arch_specific_event_help(event, buffer, MAX_BUFFER);
	init_xml_str_attr(HELP_EVENT_DESC, event->desc, buffer, MAX_BUFFER);

	init_xml_int_attr(HELP_COUNTER_MASK, event->counter_mask, buffer,
			  MAX_BUFFER);
	if (event->ext)
		init_xml_str_attr(HELP_EXT, event->ext, buffer, MAX_BUFFER);
	init_xml_int_attr(HELP_MIN_COUNT, event->min_count,
			  buffer, MAX_BUFFER);

	if (has_nested) {
		char um_type[10];
		close_xml_element(NONE, 1, buffer, MAX_BUFFER);
		open_xml_element(HELP_UNIT_MASKS, 1, buffer, MAX_BUFFER);
		init_xml_int_attr(HELP_DEFAULT_MASK, event->unit->default_mask,
				  buffer, MAX_BUFFER);
		switch (event->unit->unit_type_mask){
		case utm_bitmask:
			strncpy(um_type, "bitmask", sizeof(um_type));
			break;
		case utm_exclusive:
			strncpy(um_type, "exclusive", sizeof(um_type));
			break;
		case utm_mandatory:
			strncpy(um_type, "mandatory", sizeof(um_type));
			break;
		}
		init_xml_str_attr(HELP_UNIT_MASKS_CATEGORY, um_type, buffer, MAX_BUFFER);
		close_xml_element(NONE, 1, buffer, MAX_BUFFER);
		for (i = 0; i < event->unit->num; i++) {
			open_xml_element(HELP_UNIT_MASK, 1, buffer, MAX_BUFFER);
			init_xml_int_attr(HELP_UNIT_MASK_VALUE,
					  event->unit->um[i].value,
					  buffer, MAX_BUFFER);
			init_xml_str_attr(HELP_UNIT_MASK_DESC,
					  event->unit->um[i].desc,
					  buffer, MAX_BUFFER);
			if (event->unit->um[i].extra)
				init_xml_int_attr(HELP_UNIT_EXTRA_VALUE,
					          event->unit->um[i].extra,
					          buffer, MAX_BUFFER);
			close_xml_element(NONE, 0, buffer, MAX_BUFFER);
		}
		close_xml_element(HELP_UNIT_MASKS, 0, buffer, MAX_BUFFER);
	}
	close_xml_element(has_nested ? HELP_EVENT : NONE, has_nested,
			  buffer, MAX_BUFFER);
	printf("%s", buffer);
}
コード例 #3
0
void open_xml_events(char const * title, char const * doc, op_cpu the_cpu_type)
{
	char const * schema_version = "1.1";

	buffer[0] = '\0';
	cpu_type = the_cpu_type;
	open_xml_element(HELP_EVENTS, 1, buffer, MAX_BUFFER);
	init_xml_str_attr(SCHEMA_VERSION, schema_version, buffer, MAX_BUFFER);
	close_xml_element(NONE, 1, buffer, MAX_BUFFER);
	open_xml_element(HELP_HEADER, 1, buffer, MAX_BUFFER);
	init_xml_str_attr(HELP_TITLE, title, buffer, MAX_BUFFER);
	init_xml_str_attr(HELP_DOC, doc, buffer, MAX_BUFFER);
	close_xml_element(NONE, 0, buffer, MAX_BUFFER);
	printf("%s", buffer);
}
コード例 #4
0
void close_xml_events(void)
{
	char buffer[MAX_BUFFER];

	buffer[0] = '\0';
	close_xml_element(HELP_EVENTS, 0, buffer);
	printf("%s", buffer);
}
コード例 #5
0
ファイル: jleaker.c プロジェクト: jleaker/jleaker
static void JNICALL dumperThreadMain(__UNUSED__ jvmtiEnv* jvmti, JNIEnv* jni_env, __UNUSED__ void* arg)
{
	char* internalLeaksString;

    if (JNI_FALSE != __sync_lock_test_and_set(&gdata->dumpInProgress, JNI_TRUE))
    {
    	alert("Another dump is already in progress");
    	return;
    }
	gdata->numberOfLeaks = 0;
	initThreadData(jni_env);

	if (gdata->run_gc)
	{
		jvmtiError err;
    	debug("jleaker: Running garbage collection\n");
    	err = (*jvmti)->ForceGarbageCollection(jvmti);
    	if (err) alert("jleaker: Failed to run GC\n");
	}

    establish_connection(gdata->tcp_port);

    begin_xml_output();
    open_xml_element("memory-leaks", NULL);

	startTimer(&getThreadData()->timer, 0);

	tagAllMapsAndCollections();
	findLeaksInTaggedObjects();

	close_xml_element("memory-leaks");

	close_connection();

	stopTimer(&getThreadData()->timer, "Finished leak detection");
    releaseThreadData();
    
	internalLeaksString = findInternalMallocsLeaks();
    if (NULL != internalLeaksString)
    {
		alert("Internal jleaker error: %s\n", internalLeaksString);
		free(internalLeaksString);
    }
    if (gdata->self_check)
    {
    	selfCheck();
    }
	gdata->dumpInProgress = JNI_FALSE;
}