target.Timer クラス
パッケージ: target
説明
target.Timer
クラスを使用して、プロセッサのタイマーの詳細を提供します。たとえば、C または C++ 関数のインターフェイスと実装、周波数、タイマーのカウント方向に関する情報などです。プロファイリング用に C または C++ コードのインストルメント化に関する情報を提供するために、タイマーの詳細を target.Processor
オブジェクトと関連付けることができます。
target.Timer
オブジェクトの作成には関数 target.create
を使用します。オブジェクトを作成してから、別のステップを使用してプロパティを指定します。または、名前と値の引数を使用して、オブジェクトの作成とプロパティの指定を単一のステップで行います。
プロパティ
Name
— タイマーの名前
文字ベクトル | string
タイマーの名前。
属性:
GetAccess | public |
SetAccess | public |
Direction
— カウント方向
'Up' | 'Down'
タイマーのカウント方向。
属性:
GetAccess | public |
SetAccess | public |
APIImplementation
— API 実装
target.APIImplementation
オブジェクト
API 実装に関する情報。現在の時間を判断するために使用されます。
名前と値の引数を使用して target.Timer
オブジェクトを作成する場合、APIImplementation
プロパティに対し、以下の引数を指定します。
名前 | 説明 |
---|---|
'FunctionName' | 必須。target.Function オブジェクトの Name プロパティ。 |
'FunctionReturnType' | 必須。target.Function オブジェクトの ReturnType プロパティ。 |
'IncludeFiles' | 必須。target.BuildDependencies オブジェクトの IncludeFiles プロパティ。 |
'FunctionLanguage' | オプション。target.API オブジェクトの Language プロパティ。 |
'SourceFiles ' | オプション。target.BuildDependencies オブジェクトの SourceFiles プロパティ。 |
'IncludePaths' | オプション。target.BuildDependencies オブジェクトの IncludePaths プロパティ。 |
属性:
GetAccess | public |
SetAccess | public |
Frequency
— 周波数
スカラー
タイマー関数によって返される単位の周波数。この値は、タイマー関数の出力を秒単位に変換するために使用できます。ヘルパー クラス target.unit.Frequency
には、いくつかの共通する周波数単位が含まれます。
属性:
GetAccess | public |
SetAccess | public |
データ型: uint64
例
timer オブジェクトの作成
開発用コンピューター向けの timer オブジェクトを作成します。
タイマーの関数シグネチャを作成します。この例では、関数は uint64
データ型と関数名 timestamp_x86
を返します。
timerSignature = target.create('Function'); timerSignature.Name = 'timestamp_x86'; timerSignature.ReturnType = 'uint64';
API オブジェクト内の関数を取得します。
timerApi = target.create('API'); timerApi.Functions = timerSignature; timerApi.Language = target.Language.C; timerApi.Name = 'Linux Timer API';
関数の依存関係、つまり関数を実行するために必要なソース ファイルとヘッダー ファイルを取得します。
timerDependencies = target.create('BuildDependencies'); timerDependencies.IncludeFiles = {'host_timer_x86.h'}; timerDependencies.IncludePaths = ... {'$(MATLAB_ROOT)/toolbox/coder/profile/src'}; timerDependencies.SourceFiles = {'host_timer_x86.c'};
API と依存関係を組み合わせるオブジェクトを作成します。
timerImplementation = target.create('APIImplementation'); timerImplementation.API = timerApi; timerImplementation.BuildDependencies = timerDependencies; timerImplementation.Name = 'Linux Timer Implementation';
timer オブジェクトを作成してタイマー情報に関連付けます。
timer = target.create('Timer'); timer.APIImplementation = timerImplementation; timer.Name = 'Linux Timer';
メモ
名前と値の引数を使用して、次のコマンドで timer オブジェクトを作成できます。
timer = target.create('Timer', 'Name', 'Linux Timer', ... 'FunctionName', 'timestamp_x86', ... 'FunctionReturnType', 'uint64', ... 'FunctionLanguage', target.Language.C, ... 'SourceFiles', {'host_timer_x86.c'}, ... 'IncludeFiles', {'host_timer_x86.h'}, ... 'IncludePaths', {'$(MATLAB_ROOT)/toolbox/coder/profile/src'})
タイマーとアドオンを processor オブジェクトに割り当てます。
processor = target.get('Processor', 'Intel-x86-64 (Linux 64)'); processor.Timers = timer;
既存のオブジェクトの変更による timer オブジェクトの作成
既存の timer オブジェクトをコピーして、そのコピーの特定のプロパティ値を変更することにより、新しい timer オブジェクトを作成できます。
newTimer = target.create('Timer', ... 'Copy', 'Linux Timer', ... 'Name', 'NewTimerName', ... 'FunctionName', 'newFunctioName');
バージョン履歴
R2020b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)