static int create_func_list(int argc, char * const argv[])
{
- size_t buff_size, avail, buff_ptr, used;
- unsigned int needed;
+ size_t buff_size, avail, buff_ptr, needed, used;
char *buff;
int err;
avail = buff_size - buff_ptr;
err = trace_list_functions(buff + buff_ptr, avail, &needed);
if (err)
- printf("Error: truncated (%#x bytes needed)\n", needed);
+ printf("Error: truncated (%#zx bytes needed)\n", needed);
used = min(avail, (size_t)needed);
printf("Function trace dumped to %08lx, size %#zx\n",
(ulong)map_to_sysmem(buff + buff_ptr), used);
static int create_call_list(int argc, char * const argv[])
{
- size_t buff_size, avail, buff_ptr, used;
- unsigned int needed;
+ size_t buff_size, avail, buff_ptr, needed, used;
char *buff;
int err;
avail = buff_size - buff_ptr;
err = trace_list_calls(buff + buff_ptr, avail, &needed);
if (err)
- printf("Error: truncated (%#x bytes needed)\n", needed);
+ printf("Error: truncated (%#zx bytes needed)\n", needed);
used = min(avail, (size_t)needed);
printf("Call list dumped to %08lx, size %#zx\n",
(ulong)map_to_sysmem(buff + buff_ptr), used);
/* A header at the start of the trace output buffer */
struct trace_output_hdr {
enum trace_chunk_type type; /* Record type */
- uint32_t rec_count; /* Number of records */
+ size_t rec_count; /* Number of records */
};
/* Print statistics about traced function calls */
* @param needed Returns number of bytes used / needed
* @return 0 if ok, -1 on error (buffer exhausted)
*/
-int trace_list_functions(void *buff, int buff_size, unsigned *needed);
+int trace_list_functions(void *buff, size_t buff_size, size_t *needed);
/* Flags for ftrace_record */
enum ftrace_flags {
uint32_t flags; /* Flags and timestamp */
};
-int trace_list_calls(void *buff, int buff_size, unsigned int *needed);
+int trace_list_calls(void *buff, size_t buff_size, size_t *needed);
/**
* Turn function tracing on and off
* greater than buff_size if we ran out of space.
* @return 0 if ok, -1 if space was exhausted
*/
-int trace_list_functions(void *buff, int buff_size, unsigned int *needed)
+int trace_list_functions(void *buff, size_t buff_size, size_t *needed)
{
struct trace_output_hdr *output_hdr = NULL;
void *end, *ptr = buff;
- int func;
- int upto;
+ size_t func;
+ size_t upto;
end = buff ? buff + buff_size : NULL;
/* Add information about each function */
for (func = upto = 0; func < hdr->func_count; func++) {
- int calls = hdr->call_accum[func];
+ size_t calls = hdr->call_accum[func];
if (!calls)
continue;
return 0;
}
-int trace_list_calls(void *buff, int buff_size, unsigned *needed)
+int trace_list_calls(void *buff, size_t buff_size, size_t *needed)
{
struct trace_output_hdr *output_hdr = NULL;
void *end, *ptr = buff;
- int rec, upto;
- int count;
+ size_t rec, upto;
+ size_t count;
end = buff ? buff + buff_size : NULL;
return low >= 0 ? &func_list[low] : NULL;
}
-static int read_calls(FILE *fin, int count)
+static int read_calls(FILE *fin, size_t count)
{
struct trace_call *call_data;
int i;
- notice("call count: %d\n", count);
+ notice("call count: %zu\n", count);
call_list = (struct trace_call *)calloc(count, sizeof(*call_data));
if (!call_list) {
error("Cannot allocate call_list\n");