MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / plot_size_distribution

Function plot_size_distribution

scripts/traceAnalysis/size.py:70–110  ·  view source on GitHub ↗

plot size distribution Args: datapath (str): the path of size data file figname_prefix (str, optional): the prefix of figname. Defaults to "".

(datapath: str, figname_prefix: str = "")

Source from the content-addressed store, hash-verified

68
69
70def plot_size_distribution(datapath: str, figname_prefix: str = ""):
71 """
72 plot size distribution
73
74 Args:
75 datapath (str): the path of size data file
76 figname_prefix (str, optional): the prefix of figname. Defaults to "".
77
78 """
79
80 if not figname_prefix:
81 figname_prefix = extract_dataname(datapath)
82
83 obj_size_req_cnt, obj_size_obj_cnt = _load_size_data(datapath)
84
85 x, y = conv_to_cdf(None, data_dict=obj_size_req_cnt)
86 plt.plot(x, y, label="Request")
87
88 x, y = conv_to_cdf(None, data_dict=obj_size_obj_cnt)
89 plt.plot(x, y, label="Object")
90
91 plt.legend()
92 plt.grid(linestyle="--")
93 plt.xlabel("Object size (Byte)")
94 plt.ylabel("Fraction of requests (CDF)")
95 plt.savefig(
96 "{}/{}_size.{}".format(FIG_DIR, figname_prefix, FIG_TYPE), bbox_inches="tight"
97 )
98
99 plt.xscale("log")
100 plt.savefig(
101 "{}/{}_size_log.{}".format(FIG_DIR, figname_prefix, FIG_TYPE),
102 bbox_inches="tight",
103 )
104 plt.clf()
105
106 logger.info(
107 "plot saved to {}/{}_size.{} {}/{}_size.{}".format(
108 FIG_DIR, figname_prefix, FIG_TYPE, FIG_DIR, figname_prefix, FIG_TYPE
109 )
110 )
111
112
113if __name__ == "__main__":

Callers 1

size.pyFile · 0.85

Calls 3

extract_datanameFunction · 0.90
conv_to_cdfFunction · 0.90
_load_size_dataFunction · 0.85

Tested by

no test coverage detected