perf tools: Add fprintf methods for thread_map and cpu_map classes

For helping with debugging.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-m06n4rp7pwr6dlzwoq89cl69@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
这个提交包含在:
Arnaldo Carvalho de Melo
2012-01-19 14:07:23 -02:00
父节点 172d1b0b73
当前提交 9ae7d3351a
修改 4 个文件,包含 30 行新增0 行删除

查看文件

@@ -166,6 +166,17 @@ out:
return cpus;
}
size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp)
{
int i;
size_t printed = fprintf(fp, "%d cpu%s: ",
map->nr, map->nr > 1 ? "s" : "");
for (i = 0; i < map->nr; ++i)
printed += fprintf(fp, "%s%d", i ? ", " : "", map->map[i]);
return printed + fprintf(fp, "\n");
}
struct cpu_map *cpu_map__dummy_new(void)
{
struct cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int));