perf block: Cleanup and refactor block info functions
We have already implemented some block-info related functions.
Now it's time to do some cleanup, refactoring and move the
functions and structures to new block-info.h/block-info.c.
v4:
---
Move code for skipping column length calculation to patch:
'perf diff: Don't use hack to skip column length calculation'
v3:
---
1. Rename the patch title
2. Rename from block.h/block.c to block-info.h/block-info.c
3. Move more common part to block-info, such as
block_info__process_sym.
4. Remove the nasty hack for skipping calculation of column
length
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20191107074719.26139-3-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
0bdf181fe0
commit
6041441870
@@ -2351,25 +2351,3 @@ struct mem_info *mem_info__new(void)
|
||||
refcount_set(&mi->refcnt, 1);
|
||||
return mi;
|
||||
}
|
||||
|
||||
struct block_info *block_info__get(struct block_info *bi)
|
||||
{
|
||||
if (bi)
|
||||
refcount_inc(&bi->refcnt);
|
||||
return bi;
|
||||
}
|
||||
|
||||
void block_info__put(struct block_info *bi)
|
||||
{
|
||||
if (bi && refcount_dec_and_test(&bi->refcnt))
|
||||
free(bi);
|
||||
}
|
||||
|
||||
struct block_info *block_info__new(void)
|
||||
{
|
||||
struct block_info *bi = zalloc(sizeof(*bi));
|
||||
|
||||
if (bi)
|
||||
refcount_set(&bi->refcnt, 1);
|
||||
return bi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user