Commit 0c41a7ce authored by Xiaodong Liu's avatar Xiaodong Liu Committed by Changpeng Liu
Browse files

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: default avatarXiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449839


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent ad08de31
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -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);