mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 14:23:49 +01:00
perf data: Add perf_data__update_dir() function
Add perf_data__update_dir() to update the size for every file within the perf.data directory. Signed-off-by: Jiri Olsa <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexey Budankov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
1 parent
cd3dd8dd8f
commit
e8be135751
2 files changed
+21
No files matched your search
@@ -124,6 +124,26 @@ out_err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int perf_data__update_dir(struct perf_data *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WARN_ON(!data->is_dir))
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < data->dir.nr; i++) {
|
||||
struct perf_data_file *file = &data->dir.files[i];
|
||||
struct stat st;
|
||||
|
||||
if (fstat(file->fd, &st))
|
||||
return -1;
|
||||
|
||||
file->size = st.st_size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool check_pipe(struct perf_data *data)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
@@ -79,4 +79,5 @@ int perf_data__switch(struct perf_data *data,
|
||||
int perf_data__create_dir(struct perf_data *data, int nr);
|
||||
int perf_data__open_dir(struct perf_data *data);
|
||||
void perf_data__close_dir(struct perf_data *data);
|
||||
int perf_data__update_dir(struct perf_data *data);
|
||||
#endif /* __PERF_DATA_H */
|
||||
Reference in new issue
Block a user