|
@@ -1545,6 +1545,46 @@ struct sort_entry sort_sym_size = {
|
|
|
.se_width_idx = HISTC_SYM_SIZE,
|
|
|
};
|
|
|
|
|
|
+/* --sort dso_size */
|
|
|
+
|
|
|
+static int64_t _sort__dso_size_cmp(struct map *map_l, struct map *map_r)
|
|
|
+{
|
|
|
+ int64_t size_l = map_l != NULL ? map__size(map_l) : 0;
|
|
|
+ int64_t size_r = map_r != NULL ? map__size(map_r) : 0;
|
|
|
+
|
|
|
+ return size_l < size_r ? -1 :
|
|
|
+ size_l == size_r ? 0 : 1;
|
|
|
+}
|
|
|
+
|
|
|
+static int64_t
|
|
|
+sort__dso_size_cmp(struct hist_entry *left, struct hist_entry *right)
|
|
|
+{
|
|
|
+ return _sort__dso_size_cmp(right->ms.map, left->ms.map);
|
|
|
+}
|
|
|
+
|
|
|
+static int _hist_entry__dso_size_snprintf(struct map *map, char *bf,
|
|
|
+ size_t bf_size, unsigned int width)
|
|
|
+{
|
|
|
+ if (map && map->dso)
|
|
|
+ return repsep_snprintf(bf, bf_size, "%*d", width,
|
|
|
+ map__size(map));
|
|
|
+
|
|
|
+ return repsep_snprintf(bf, bf_size, "%*s", width, "unknown");
|
|
|
+}
|
|
|
+
|
|
|
+static int hist_entry__dso_size_snprintf(struct hist_entry *he, char *bf,
|
|
|
+ size_t size, unsigned int width)
|
|
|
+{
|
|
|
+ return _hist_entry__dso_size_snprintf(he->ms.map, bf, size, width);
|
|
|
+}
|
|
|
+
|
|
|
+struct sort_entry sort_dso_size = {
|
|
|
+ .se_header = "DSO size",
|
|
|
+ .se_cmp = sort__dso_size_cmp,
|
|
|
+ .se_snprintf = hist_entry__dso_size_snprintf,
|
|
|
+ .se_width_idx = HISTC_DSO_SIZE,
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
struct sort_dimension {
|
|
|
const char *name;
|
|
@@ -1569,6 +1609,7 @@ static struct sort_dimension common_sort_dimensions[] = {
|
|
|
DIM(SORT_TRANSACTION, "transaction", sort_transaction),
|
|
|
DIM(SORT_TRACE, "trace", sort_trace),
|
|
|
DIM(SORT_SYM_SIZE, "symbol_size", sort_sym_size),
|
|
|
+ DIM(SORT_DSO_SIZE, "dso_size", sort_dso_size),
|
|
|
DIM(SORT_CGROUP_ID, "cgroup_id", sort_cgroup_id),
|
|
|
};
|
|
|
|