Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maps should be able to store record values (anonymous structs) #79

Open
wells39 opened this issue Feb 9, 2022 · 5 comments
Open

Maps should be able to store record values (anonymous structs) #79

wells39 opened this issue Feb 9, 2022 · 5 comments

Comments

@wells39
Copy link

wells39 commented Feb 9, 2022

I am very interesting to this tool,have any material to understand this tool deeply. Whether the map can store a struct for take more data one time? If i want to implenment this demand, what can i do

@wkz
Copy link
Collaborator

wkz commented Feb 10, 2022

Regarding getting a deeper understanding of ply, have you looked at the manual? https://wkz.github.io/ply/ply.1.html

Can can easily key a map using multiple variables, i.e. something like:

ply 't:sched/sched_wakeup { @[data->comm, data->pid] = count(); }'

You can also use an entire struct as the key:

ply 't:sched/sched_wakeup { @[*data] = count(); }'

Similarly you can also have a struct as the value of a map:

ply 't:sched/sched_wakeup { log[time] = *data; }'

I have though about adding support for creating custom "records" in the same way that you can compose map keys arbitrarily. Something like:

ply 't:sched/sched_wakeup { log[time] = [data->comm, data->pid]; }'

Is that what you are looking for? Could you give an example of what you mean? Or a problem you want to solve?

@wells39
Copy link
Author

wells39 commented Mar 10, 2022

great,this is my wanna. Thanks.
and bytheway, could this apply to a kprobe/kretprobe providers ?

@wkz
Copy link
Collaborator

wkz commented Mar 10, 2022

Are you saying that you need the record feature that I described at the bottom of my reply, or are you happy with what is already available?

Guessing that you are talking about records, then yes, when implemented, that would apply to all kinds of providers.

@wells39
Copy link
Author

wells39 commented Mar 11, 2022

em. yes, i am interesting with the ability about record. i mistake for it had already implemented.

@wkz
Copy link
Collaborator

wkz commented Mar 11, 2022

I see, no that is not supported yet I'm afraid. Should be pretty easy to add though.

I'll update the subject of the issue so that I remember what it is about.

@wkz wkz changed the title Consider supporting a struct to stroe in map? Maps should be able to store record values (anonymous structs) Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants