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

Allow ResponseWithReturnValueInPayload to be passed into dtxConnection.Dispatch #552

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

cziter15
Copy link
Contributor

@cziter15 cziter15 commented Jan 24, 2025

DESCRIPTION

When using a custom dispatcher for channel graphics messages, it appears that the ResponseWithReturnValueInPayload message type is returned periodically. However, the func (g GlobalDispatcher) Dispatch(msg Message) function currently only handles UnknownTypeOne. To properly receive GPU statistics, I had to modify the dispatcher to handle the ResponseWithReturnValueInPayload type as well, ensuring it is correctly passed into the Dispatch function.

Here's pseudocode for reference:

type mDispatcher struct {
}

func (md*mDispatcher ) Dispatch(msg dtx.Message) {
}

func (mp* mProvider)  InitializeWithDispatcher(device ios.DeviceEntry, msgDispatcher dtx.Dispatcher) error {
	conn, err := connectInstruments(device)
	conn.MessageDispatcher = msgDispatcher
	channel := mp.dtxConn.RequestChannelIdentifier(graphicsChannelName, nil)
	_, err := channel.MethodCall("startSamplingAtTimeInterval:", 0)
	conn.MessageDispatcher = msgDispatcher
	mp.dtxConn = conn
	return nil
}

Copy link
Owner

@danielpaulus danielpaulus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@danielpaulus danielpaulus merged commit 376dba1 into danielpaulus:main Jan 24, 2025
2 checks passed
@sarxos
Copy link

sarxos commented Jan 24, 2025

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants