/* we resolved an unknown class (unless we had the code unloaded) */
if (cd) {
/*printf ("resolved unknown: %s\n", name);*/
- free (cd->name);
+ g_free (cd->name);
cd->name = pstrdup (name);
return cd;
}
cd->code = code;
cd->len = len;
/*printf ("resolved unknown: %s\n", name);*/
- free (cd->name);
+ g_free (cd->name);
cd->name = pstrdup (name);
return cd;
}
add_rev_class_hashed (n, to->rev_hash_size, to->rev_hash [i].klass, to->rev_hash [i].count);
}
if (to->rev_hash)
- free (to->rev_hash);
+ g_free (to->rev_hash);
to->rev_hash = n;
}
to->rev_count += add_rev_class_hashed (to->rev_hash, to->rev_hash_size, from, 1);
add_heap_hashed (n, &res, hs->hash_size, hs->class_hash [i]->klass, hs->class_hash [i]->total_size, hs->class_hash [i]->count);
}
if (hs->class_hash)
- free (hs->class_hash);
+ g_free (hs->class_hash);
hs->class_hash = n;
}
res = NULL;
HeapObjectDesc* ho = alloc_heap_obj (objaddr, hash [i]->hklass, hash [i]->num_refs + num);
*ref_offset = hash [i]->num_refs;
memcpy (ho->refs, hash [i]->refs, hash [i]->num_refs * sizeof (uintptr_t));
- free (hash [i]);
+ g_free (hash [i]);
hash [i] = ho;
return ho;
}
add_heap_hashed_obj (n, hs->objects_hash_size, hs->objects_hash [i]);
}
if (hs->objects_hash)
- free (hs->objects_hash);
+ g_free (hs->objects_hash);
hs->objects_hash = n;
}
hs->objects_count += add_heap_hashed_obj (hs->objects_hash, hs->objects_hash_size, obj);
}
}
fprintf (outfile, "Total unmarked: %zd/%zd\n", num_unmarked, hs->objects_count);
- free (marks);
+ g_free (marks);
}
static void
for (i = 0; i < hs->objects_hash_size; ++i) {
HeapObjectDesc *ho = hs->objects_hash [i];
if (ho)
- free (ho);
+ g_free (ho);
}
if (hs->objects_hash)
- free (hs->objects_hash);
+ g_free (hs->objects_hash);
hs->objects_hash = NULL;
hs->objects_hash_size = 0;
hs->objects_count = 0;
int timer_overhead;
int pid;
int port;
+ char *args;
+ char *arch;
+ char *os;
uint64_t startup_time;
ThreadContext *threads;
ThreadContext *current_thread;
add_trace_hashed (n, trace->size, trace->traces [i].bt, trace->traces [i].count);
}
if (trace->traces)
- free (trace->traces);
+ g_free (trace->traces);
trace->traces = n;
}
trace->count += add_trace_hashed (trace->traces, trace->size, bt, value);
if (debug)
fprintf (outfile, "handle (%s) %u created for object %p\n", get_handle_name (htype), handle, (void*)OBJ_ADDR (objdiff));
if (frames != sframes)
- free (frames);
+ g_free (frames);
} else if (subtype == TYPE_GC_HANDLE_DESTROYED || subtype == TYPE_GC_HANDLE_DESTROYED_BT) {
int has_bt = subtype == TYPE_GC_HANDLE_DESTROYED_BT;
int num_bt = 0;
if (debug)
fprintf (outfile, "handle (%s) %u destroyed\n", get_handle_name (htype), handle);
if (frames != sframes)
- free (frames);
+ g_free (frames);
} else if (subtype == TYPE_GC_FINALIZE_START) {
// TODO: Generate a finalizer report based on these events.
if (debug)
tracked_creation (OBJ_ADDR (objdiff), cd, len, bt, time_base);
}
if (frames != sframes)
- free (frames);
+ g_free (frames);
break;
}
case TYPE_METHOD: {
hs->roots_extra = thread->roots_extra;
hs->roots_types = thread->roots_types;
} else {
- free (thread->roots);
- free (thread->roots_extra);
- free (thread->roots_types);
+ g_free (thread->roots);
+ g_free (thread->roots_extra);
+ g_free (thread->roots_types);
}
thread->num_roots = 0;
thread->size_roots = 0;
if (debug)
fprintf (outfile, "monitor %s for object %p\n", monitor_ev_name (event), (void*)OBJ_ADDR (objdiff));
if (frames != sframes)
- free (frames);
+ g_free (frames);
break;
}
case TYPE_EXCEPTION: {
int subtype = *p & 0x70;
- int has_bt = *p & TYPE_EXCEPTION_BT;
+ int has_bt = *p & TYPE_THROW_BT;
uint64_t tdiff = decode_uleb128 (p + 1, &p);
MethodDesc* sframes [8];
MethodDesc** frames = sframes;
add_trace_thread (thread, &exc_traces, 1);
}
if (frames != sframes)
- free (frames);
+ g_free (frames);
if (debug)
fprintf (outfile, "throw %p\n", (void*)OBJ_ADDR (objdiff));
}
return 1;
}
+static int
+read_header_string (ProfContext *ctx, char **field)
+{
+ if (!load_data (ctx, 4))
+ return 0;
+
+ if (!load_data (ctx, read_int32 (ctx->buf)))
+ return 0;
+
+ *field = pstrdup ((const char *) ctx->buf);
+
+ return 1;
+}
+
static ProfContext*
load_file (char *name)
{
if (ctx->file != stdin)
ctx->gzfile = gzdopen (fileno (ctx->file), "rb");
#endif
- if (!load_data (ctx, 32))
+ if (!load_data (ctx, 30))
return NULL;
p = ctx->buf;
if (read_int32 (p) != LOG_HEADER_ID || p [6] > LOG_DATA_VERSION)
ctx->timer_overhead = read_int32 (p + 16);
ctx->pid = read_int32 (p + 24);
ctx->port = read_int16 (p + 28);
+ if (ctx->version_major >= 1) {
+ if (!read_header_string (ctx, &ctx->args))
+ return NULL;
+ if (!read_header_string (ctx, &ctx->arch))
+ return NULL;
+ if (!read_header_string (ctx, &ctx->os))
+ return NULL;
+ } else {
+ if (!load_data (ctx, 2)) /* old opsys field, was never used */
+ return NULL;
+ }
return ctx;
}
fprintf (outfile, "\nMono log profiler data\n");
fprintf (outfile, "\tProfiler version: %d.%d\n", ctx->version_major, ctx->version_minor);
fprintf (outfile, "\tData version: %d\n", ctx->data_version);
+ if (ctx->version_major >= 1) {
+ fprintf (outfile, "\tArguments: %s\n", ctx->args);
+ fprintf (outfile, "\tArchitecture: %s\n", ctx->arch);
+ fprintf (outfile, "\tOperating system: %s\n", ctx->os);
+ }
fprintf (outfile, "\tMean timer overhead: %d nanoseconds\n", ctx->timer_overhead);
fprintf (outfile, "\tProgram startup: %s", t);
if (ctx->pid)
if (cd->root_references)
fprintf (outfile, "\t\t%zd root references (%zd pinning)\n", cd->root_references, cd->pinned_references);
dump_rev_claases (rev_sorted, cd->rev_count);
- free (rev_sorted);
+ g_free (rev_sorted);
}
- free (sorted);
+ g_free (sorted);
}
static int
DUMP_EVENT_STAT (TYPE_METHOD, TYPE_EXC_LEAVE);
DUMP_EVENT_STAT (TYPE_METHOD, TYPE_JIT);
- DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_THROW);
+ DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_THROW_NO_BT);
+ DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_THROW_BT);
DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_CLAUSE);
- DUMP_EVENT_STAT (TYPE_EXCEPTION, TYPE_EXCEPTION_BT);
DUMP_EVENT_STAT (TYPE_MONITOR, TYPE_MONITOR_NO_BT);
DUMP_EVENT_STAT (TYPE_MONITOR, TYPE_MONITOR_BT);
*top++ = 0;
from_secs = atof (val);
to_secs = atof (top);
- free (val);
+ g_free (val);
if (from_secs > to_secs) {
usage ();
return 1;