awslabs / damo

DAMON user-space tool
https://damonitor.github.io/
GNU General Public License v2.0
149 stars 28 forks source link

Hiding quotas and watermarks when unused in fmt_json #104

Open honggyukim opened 2 weeks ago

honggyukim commented 2 weeks ago

Hi SeongJae,

I run damo fmt_json often but found that it shows too verbose output especially for quotas and watermarks.

It currently shows as follows.

$ sudo ./damo fmt_json --damos_action pageout
{
    "kdamonds": [
        {
            "state": null,
            "pid": null,
            "contexts": [
                {
                    "ops": "paddr",
                    "targets": [
                        {
                            "pid": null,
                            "regions": [
                                {
                                    "start": "4,294,967,296",
                                    "end": "551,903,297,535"
                                }
                            ]
                        }
                    ],
                    "intervals": {
                        "sample_us": "5 ms",
                        "aggr_us": "100 ms",
                        "ops_update_us": "1 s"
                    },
                    "nr_regions": {
                        "min": "10",
                        "max": "1,000"
                    },
                    "schemes": [
                        {
                            "action": "pageout",
                            "access_pattern": {
                                "sz_bytes": {
                                    "min": "0 B",
                                    "max": "max"
                                },
                                "nr_accesses": {
                                    "min": "0 %",
                                    "max": "18,446,744,073,709,551,615 %"
                                },
                                "age": {
                                    "min": "0 ns",
                                    "max": "max"
                                }
                            },
                            "apply_interval_us": 0,
                            "quotas": {
                                "time_ms": "0 ns",
                                "sz_bytes": "0 B",
                                "reset_interval_ms": "max",
                                "goals": [],
                                "effective_sz_bytes": "0 B",
                                "weights": {
                                    "sz_permil": "0 %",
                                    "nr_accesses_permil": "0 %",
                                    "age_permil": "0 %"
                                }
                            },
                            "watermarks": {
                                "metric": "none",
                                "interval_us": "0 ns",
                                "high_permil": "0 %",
                                "mid_permil": "0 %",
                                "low_permil": "0 %"
                            },
                            "filters": []
                        }
                    ]
                }
            ]
        }
    ]
}

I would like to make it shorter by hiding quotas and watermarks when unused as follows.

$ sudo ./damo fmt_json --damos_action pageout
{
    "kdamonds": [
        {
            "state": null,
            "pid": null,
            "contexts": [
                {
                    "ops": "paddr",
                    "targets": [
                        {
                            "pid": null,
                            "regions": [
                                {
                                    "start": "4,294,967,296",
                                    "end": "551,903,297,535"
                                }
                            ]
                        }
                    ],
                    "intervals": {
                        "sample_us": "5 ms",
                        "aggr_us": "100 ms",
                        "ops_update_us": "1 s"
                    },
                    "nr_regions": {
                        "min": "10",
                        "max": "1,000"
                    },
                    "schemes": [
                        {
                            "action": "pageout",
                            "access_pattern": {
                                "sz_bytes": {
                                    "min": "0 B",
                                    "max": "max"
                                },
                                "nr_accesses": {
                                    "min": "0 %",
                                    "max": "18,446,744,073,709,551,615 %"
                                },
                                "age": {
                                    "min": "0 ns",
                                    "max": "max"
                                }
                            },
                            "apply_interval_us": 0,
                            "filters": []
                        }
                    ]
                }
            ]
        }
    ]
}

It will make the output a lot simpler so I would like to hear how you think about this.

Maybe access_pattern can be hidden and leaving it use default settings but not sure about this.

sj-aws commented 2 weeks ago

Thank you for your great opinion, Honggyu! I agree the current output is too verbose, and better to be concise. I will try to make it. Nonetheless, could you please share your usage of the command in more detail, so that the result be useful for you?