app/trace: remove redundant memory/pointer

Previously, copying trace-file from disk or page-cache
to memory aims to accelerate disk-read in one large
sequential read.
But it shows no value, since trace-data are originally
retrieved sequentially, and page-cache can handle it
well.

Change-Id: I1c328286686ed05e83f3b7a1bef10dc353c5b653
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449839
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Xiaodong Liu 2019-04-01 22:57:16 +08:00 committed by Changpeng Liu
parent ad08de311e
commit 0c41a7ce95

View File

@ -285,7 +285,6 @@ int main(int argc, char **argv)
{
void *history_ptr;
struct spdk_trace_history *history;
struct spdk_trace_histories *histories;
int fd, i, rc;
int lcore = SPDK_TRACE_MAX_LCORE;
uint64_t tsc_offset;
@ -409,16 +408,9 @@ int main(int argc, char **argv)
g_histories = (struct spdk_trace_histories *)history_ptr;
histories = (struct spdk_trace_histories *)malloc(trace_histories_size);
if (histories == NULL) {
goto cleanup;
}
memcpy(histories, g_histories, trace_histories_size);
if (lcore == SPDK_TRACE_MAX_LCORE) {
for (i = 0; i < SPDK_TRACE_MAX_LCORE; i++) {
history = spdk_get_per_lcore_history(histories, i);
history = spdk_get_per_lcore_history(g_histories, i);
if (history->entries[0].tsc == 0) {
continue;
}
@ -430,7 +422,7 @@ int main(int argc, char **argv)
populate_events(history, history->num_entries);
}
} else {
history = spdk_get_per_lcore_history(histories, lcore);
history = spdk_get_per_lcore_history(g_histories, lcore);
if (history->entries[0].tsc != 0) {
if (g_verbose && history->num_entries) {
printf("Trace Size of lcore (%d): %ju\n", lcore, history->num_entries);
@ -448,9 +440,6 @@ int main(int argc, char **argv)
process_event(it->second, g_tsc_rate, tsc_offset, it->first.lcore);
}
free(histories);
cleanup:
munmap(history_ptr, trace_histories_size);
close(fd);