Skip to content

Instantly share code, notes, and snippets.

@iondune
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save iondune/f876e778ffc2b3f70799 to your computer and use it in GitHub Desktop.

Select an option

Save iondune/f876e778ffc2b3f70799 to your computer and use it in GitHub Desktop.
Interface for IHV metrics
#pragma once
#include <vector>
#include <map>
#include <string>
struct ID3D11Device;
typedef unsigned __int64 uint64;
class MetricsInterface
{
public:
// The Intel metrics API has some initialization work that must be done _before_
// the D3D device is initialized.
virtual bool InitializeAPI() = 0;
virtual bool DeinitializeAPI() = 0;
// Our metrics API operates different depending on which rendering API is used, so there
// would probably need to be some hardcoded mechanisms for providing API-specific context,
// a la this method
virtual void SetD3D11Device(ID3D11Device *pDevice) = 0;
// Called before the query to profile
virtual void BeginQuery() = 0;
// ... and called after
virtual void EndQuery() = 0;
virtual std::vector<std::string> GetAvailableMetrics() = 0;
// Most of the metrics I am looking at right now use 32 and 64bit unsigned integers
// We have some that may be better represented as a floating point type (e.g. percentages)
// So possibly some wrapper like boost::any should be used here
virtual std::map<std::string, uint64> GetAllMetrics() = 0;
virtual uint64 GetMetric(std::string const & label) = 0;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment