linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Yordan Karadzhov <ykaradzhov@vmware.com>,
	"linux-trace-devel@vger.kernel.org"
	<linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH v2 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions.
Date: Fri, 5 Oct 2018 18:27:20 +0300	[thread overview]
Message-ID: <ad5dcd71-aa99-f2d0-f586-8f8af9e03bab@gmail.com> (raw)
In-Reply-To: <20181005104607.0f205018@gandalf.local.home>



On  5.10.2018 17:46, Steven Rostedt wrote:
>>>>> +/**
>>>>> + * @brief This function allows for an easy access to the original value of the
>>>>> + *	  Process Id as recorded in the tep_record object. The record is read
>>>>> + *	  from the file only in the case of an entry being touched by a plugin.
>>>>> + *	  Be aware that using the kshark_get_X_easy functions can be
>>>>> + *	  inefficient if you need an access to more than one of the data fields
>>>>> + *	  of the record.
>>>>> + *
>>>>> + * @param entry: Input location for the KernelShark entry.
>>>>> + *
>>>>> + * @returns The original value of the Process Id as recorded in the
>>>>> + *	    tep_record object on success, otherwise negative error code.
>>>>> + */
>>>>> +int kshark_get_pid_easy(struct kshark_entry *entry)
>>>>> +{
>>>>> +	struct kshark_context *kshark_ctx = NULL;
>>>>> +	struct tep_record *data;
>>>>> +	int pid;
>>>>> +
>>>>> +	if (!kshark_instance(&kshark_ctx))
>>>>> +		return -EFAULT;
>>>> Perhaps this should return -ENODEV;
>>>>   
>>>>> +
>>>>> +	if (entry->visible & KS_PLUGIN_UNTOUCHED_MASK) {
>>>> What's the "UNTOUCHED_MASK" mean?
>>> We use the KS_PLUGIN_UNTOUCHED_MASK to check the flag (bit)
>>> which indicates if the entry has been touched and potential modified by
>>> a plugin callback function. If the bit is set this means untouched.
>>>
>>> This flag (bit) gets set when we load the data ( libkshark.c /
>>> get_records())
>>>
>>> 	entry->visible = 0xFF;
>>>
>>> ...
>>>
>>> 	/* Execute all plugin-provided actions (if any). */
>>> 	evt_handler = kshark_ctx->event_handlers;
>>> 	while ((evt_handler = kshark_find_event_handler(evt_handler,
>>> 						entry->event_id))) {
>>> 		evt_handler->event_func(kshark_ctx, rec, entry);
>>> 		evt_handler = evt_handler->next;
>>> 		if (!evt_handler)
>>> 			entry->visible &= ~KS_PLUGIN_UNTOUCHED_MASK;
>>> 	}
>>>    
>>>>   
>>>>> +		pid = entry->pid;
>>>>> +	} else {
>>> In this case the entry has been touched by a plugin. Because of this we
>>> do not trust the value of "entry->pid".
> I guess my question is, can we reset the entry->pid back to something
> we do trust, and clear the flag?
> 
> Or do we not want to modify it, because the plugin now owns the value?
> 

If the value of "entry->pid" has been changed then the new value will be 
used when plotting graphs and we do not want to change this.
However, we still want to be able to retrieve the original value. The 
description of the function explains that it will return the original value.

Thanks!
Yordan

> -- Steve
> 

  reply	other threads:[~2018-10-05 22:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01 13:59 [PATCH v2 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
2018-10-01 13:59 ` [PATCH v2 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions Yordan Karadzhov
2018-10-02 20:44   ` Steven Rostedt
2018-10-03  7:34     ` Yordan Karadzhov
2018-10-05 14:30       ` Yordan Karadzhov (VMware)
2018-10-05 14:46         ` Steven Rostedt
2018-10-05 15:27           ` Yordan Karadzhov (VMware) [this message]
2018-10-05 15:44             ` Steven Rostedt
2018-10-01 13:59 ` [PATCH v2 2/5] kernel-shark-qt: Add kshark_convert_nano() function Yordan Karadzhov
2018-10-02 21:09   ` Steven Rostedt
2018-10-01 13:59 ` [PATCH v2 3/5] kernel-shark-qt: Add functions for fast clearing of the filters Yordan Karadzhov
2018-10-01 13:59 ` [PATCH v2 4/5] kernel-shark-qt: Rename the Cmake-generated header file Yordan Karadzhov
2018-10-01 13:59 ` [PATCH v2 5/5] kernel-shark-qt: Fix a bug in kshark_data_collection_alloc() Yordan Karadzhov
2018-10-02 21:18   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad5dcd71-aa99-f2d0-f586-8f8af9e03bab@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=ykaradzhov@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).