メインコンテンツ

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

target.Processor クラス

名前空間: target

ターゲット プロセッサ情報の提供

説明

target.Processor クラスを使用して、ターゲット プロセッサに関する情報を提供します。たとえば、名前、製造元、言語実装などです。

target.Processor オブジェクトの作成には関数 target.create を使用します。

プロパティ

すべて展開する

オブジェクト識別子は、ManufacturerName プロパティ値をハイフンでつないだ組み合わせです。Manufacturer プロパティが空の場合、オブジェクト識別子は Name プロパティ値です。

属性:

GetAccess
public
SetAccess
private

関連付けられている target.LanguageImplementation オブジェクト。

属性:

GetAccess
public
SetAccess
public

ターゲット プロセッサの名前。

例: 'Cortex-A53'

属性:

GetAccess
public
SetAccess
public

ターゲット プロセッサの製造元に関するオプションの説明。

例: 'ARM Compatible'

属性:

GetAccess
public
SetAccess
public

タイマー情報を提供します。

属性:

GetAccess
public
SetAccess
public

実行時間の測定から除くインストルメンテーション オーバーヘッド値を指定します。

属性:

GetAccess
public
SetAccess
public

プロセッサ内の物理コア数。

属性:

GetAccess
public
SetAccess
public

データ型: uint

プロセッサ コアあたりのスレッド数。

属性:

GetAccess
public
SetAccess
public

データ型: uint

プロセッサが提供する論理コア数 (NumberOfCores x NumberOfThreadsPerCore と等しい)。

属性:

GetAccess
public
SetAccess
private

データ型: uint

すべて折りたたむ

この例では、新しいハードウェア デバイスを登録する方法を示します。

新しいハードウェア デバイス用の target.Processor オブジェクトを作成します。

myProc = target.create("Processor",Name="MyProcessor", ...
                        Manufacturer="MyManufacturer");

言語実装の詳細を指定するための target.LanguageImplementation オブジェクトを作成します。

myLanguageImplementation = target.create("LanguageImplementation", ...
                                          Name="MyProcessorImplementation");

言語実装の詳細を指定します。

myLanguageImplementation.Endianess = target.Endianess.Little;

myLanguageImplementation.AtomicIntegerSize = 64;
myLanguageImplementation.AtomicFloatSize = 64;
myLanguageImplementation.WordSize = 64;

myLanguageImplementation.DataTypes.Char.Size = 8;
myLanguageImplementation.DataTypes.Short.Size = 16;
myLanguageImplementation.DataTypes.Int.Size = 32;
myLanguageImplementation.DataTypes.Long.Size = 64;
myLanguageImplementation.DataTypes.LongLong.IsSupported = true;
myLanguageImplementation.DataTypes.LongLong.Size = 64;
myLanguageImplementation.DataTypes.Float.Size = 32;
myLanguageImplementation.DataTypes.Double.Size = 64;

myLanguageImplementation.DataTypes.Pointer.Size = 32;

myLanguageImplementation.DataTypes.SizeT.Size = 64;
myLanguageImplementation.DataTypes.PtrDiffT.Size = 64;

言語実装をハードウェア デバイスと関連付けます。

myProc.LanguageImplementations = myLanguageImplementation;

target.Processor オブジェクトを内部データベースに追加します。

objectsAdded = target.add(myProc);
target.add summary:

    Objects added to internal database for current MATLAB session:
        target.LanguageImplementation    "MyProcessorImplementation"
        target.Processor                 "MyManufacturer-MyProcessor"
  • MATLAB® Coder™ を使用している場合: [ハードウェア] タブに新しいデバイスが表示されます。また、coder.hardware関数を使用して、このデバイスの coder.Hardware オブジェクトを作成できるようにもなりました。

  • Simulink® Coder™ を使用している場合: [ハードウェア実行] ペインで、[デバイス ベンダー][デバイス タイプ] をそれぞれ MyManufacturerMyProcessor に設定できるようになりました。

オブジェクトを内部データベースから削除するには、以下を入力します。

target.remove(objectsAdded)
target.remove summary:

    Objects removed from internal database:
        target.LanguageImplementation    "MyProcessorImplementation"
        target.Processor                 "MyManufacturer-MyProcessor"

新しいハードウェア実行で必要な値のほとんどが既存のハードウェア実行に含まれている場合は、既存の実行のコピーを作成して変更することで、新しい実行を迅速に作成することができます。

新しいハードウェア デバイス用の target.Processor オブジェクトを作成します。

myProc = target.create("Processor",Name="MyProcessor", ...
                        Manufacturer="MyManufacturer");

既存の言語実装をコピーする target.LanguageImplementation オブジェクトを作成します。

myCopiedImplementation = target.create("LanguageImplementation", ...
                                      Name="MyCopiedImplementation", ...
                                      Copy="Atmel-AVR");

必要な言語実装の詳細を指定します。たとえば、バイト順などです。

myCopiedImplementation.Endianess = target.Endianess.Big;

言語実装をハードウェア デバイスと関連付けます。

myProc.LanguageImplementations = myCopiedImplementation;

target.Processor オブジェクトを内部データベースに追加します。

objectsAdded = target.add(myProc);
target.add summary:

    Objects added to internal database for current MATLAB session:
        target.LanguageImplementation    "MyCopiedImplementation"
        target.Processor                 "MyManufacturer-MyProcessor"

オブジェクトを内部データベースから削除するには、以下を入力します。

target.remove(objectsAdded)
target.remove summary:

    Objects removed from internal database:
        target.LanguageImplementation    "MyCopiedImplementation"
        target.Processor                 "MyManufacturer-MyProcessor"

ハードウェア デバイスで既存の実行と同じハードウェア実行が必要な場合、既存の実行を再利用できます。

新しいハードウェア デバイス用の target.Processor オブジェクトを作成します。

myProc = target.create( "Processor",Name="MyProcessor", ...
                        Manufacturer="MyManufacturer");

デバイス ベンダーとタイプについての識別子を使用することで、既存の実行を取得します。

existingImplementation = target.get("LanguageImplementation", ...
                                  "ARM Compatible-ARM Cortex");

言語実装をハードウェア デバイスと関連付けます。

myProc.LanguageImplementations = existingImplementation;

target.Processor オブジェクトを内部データベースに追加します。

objectsAdded = target.add(myProc);
target.add summary:

    Objects added to internal database for current MATLAB session:
        target.Processor                 "MyManufacturer-MyProcessor"
    1 object not added because they already exist.

オブジェクトを内部データベースから削除するには、以下を入力します。

target.remove(objectsAdded);
target.remove summary:

    Objects removed from internal database:
        target.Processor    "MyManufacturer-MyProcessor"

この例では、開発用コンピューター向けの 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;

ハイパースレッディングをサポートするプロセッサである Intel Core® i7-8550U プロセッサの説明を作成します。

i7 = target.create('Processor', ...
                   'Name', 'i7-8550U', ...
                   'Manufacturer', 'Intel', ...
                   'NumberOfCores', 4, ...
                   'NumberOfThreadsPerCore', 2);
target.add(i7);

バージョン履歴

R2019a で導入