target.Processor Class
Namespace: target
Provide target processor information
Description
Use the target.Processor
class to provide information about your target
processor. For example, name, manufacturer, and language implementation.
To create a target.Processor
object, use the target.create
function.
Properties
Id
— Object identifier
character vector | string
The object identifier is the hyphenated combination of the
Manufacturer
and Name
property values. If the
Manufacturer
property is empty, the object identifier is the
Name
property value.
Attributes:
GetAccess | public |
SetAccess | private |
LanguageImplementations
— Language implementation
object
Associated target.LanguageImplementation
object.
Attributes:
GetAccess | public |
SetAccess | public |
Name
— Processor name
character vector | string
Name of the target processor.
Example: 'Cortex-A53'
Attributes:
GetAccess | public |
SetAccess | public |
Manufacturer
— Processor manufacturer
character vector | string
Optional description of the target processor manufacturer.
Example: 'ARM Compatible'
Attributes:
GetAccess | public |
SetAccess | public |
Timers
— Timers
target.Counter
object array
Provide timer information.
Attributes:
GetAccess | public |
SetAccess | public |
Overheads
— Profiling instrumentation overheads
vector
Specify instrumentation overhead values for removal from execution-time measurements.
Attributes:
GetAccess | public |
SetAccess | public |
NumberOfCores
— Processor cores
1 (default) | scalar
Number of physical cores in processor.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: uint
NumberOfThreadsPerCore
— Threads per processor core
1 (default) | scalar
Number of threads per processor core.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: uint
NumberOfLogicalCores
— Logical cores
scalar
Number of logical cores that processor provides, which is equal to
NumberOfCores
x NumberOfThreadsPerCore
.
Attributes:
GetAccess | public |
SetAccess | private |
Data Types: uint
Examples
Specify Hardware Implementation for New Device
This example shows how to register a new hardware device.
Create a target.Processor
object for the new hardware device.
myProc = target.create("Processor",Name="MyProcessor", ... Manufacturer="MyManufacturer");
Create a target.LanguageImplementation
object for language implementation details.
myLanguageImplementation = target.create("LanguageImplementation", ... Name="MyProcessorImplementation");
Specify language implementation details.
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;
Associate the language implementation with the hardware device.
myProc.LanguageImplementations = myLanguageImplementation;
Add the target.Processor
object to an internal database.
objectsAdded = target.add(myProc);
"target.add" summary: Objects added to internal database for current MATLAB session: target.LanguageImplementation "MyProcessorImplementation" target.Processor "MyManufacturer-MyProcessor"
If you are using the MATLAB® Coder™: On the Hardware tab, you see the new device. Alternatively, you can now create a
coder.Hardware
object for this device by using thecoder.hardware
function.If you are using the Simulink® Coder™: On the Hardware Implementation pane, you can now set Device vendor and Device type to
MyManufacturer
andMyProcessor
respectively.
To remove the objects from the internal database, enter:
target.remove(objectsAdded)
"target.remove" summary: Objects removed from internal database: target.LanguageImplementation "MyProcessorImplementation" target.Processor "MyManufacturer-MyProcessor"
Create Hardware Implementation by Modifying Existing Implementation
If an existing hardware implementation contains most of the values that you want in a new hardware implementation, you can quickly create the new implementation by creating and modifying a copy of the existing implementation.
Create a target.Processor
object for the new hardware device.
myProc = target.create("Processor",Name="MyProcessor", ... Manufacturer="MyManufacturer");
Create a target.LanguageImplementation
object that copies an existing language implementation.
myCopiedImplementation = target.create("LanguageImplementation", ... Name="MyCopiedImplementation", ... Copy="Atmel-AVR");
Specify the required language implementation details. For example, byte ordering.
myCopiedImplementation.Endianess = target.Endianess.Big;
Associate the language implementation with the hardware device.
myProc.LanguageImplementations = myCopiedImplementation;
Add the target.Processor
object to an internal database.
objectsAdded = target.add(myProc);
"target.add" summary: Objects added to internal database for current MATLAB session: target.LanguageImplementation "MyCopiedImplementation" target.Processor "MyManufacturer-MyProcessor"
To remove the objects from the internal database, enter:
target.remove(objectsAdded)
"target.remove" summary: Objects removed from internal database: target.LanguageImplementation "MyCopiedImplementation" target.Processor "MyManufacturer-MyProcessor"
Create Hardware Implementation by Reusing Existing Implementation
If your hardware device requires the same hardware implementation as an existing implementation, you can reuse the existing implementation.
Create a target.Processor
object for the new hardware device.
myProc = target.create( "Processor",Name="MyProcessor", ... Manufacturer="MyManufacturer");
Retrieve the existing implementation by using the identifier for the device vendor and type.
existingImplementation = target.get("LanguageImplementation", ... "ARM Compatible-ARM Cortex");
Associate the language implementation with the hardware device.
myProc.LanguageImplementations = existingImplementation;
Add the target.Processor
object to an internal database.
objectsAdded = target.add(myProc);
"target.add" summary: Objects added to internal database for current MATLAB session: target.Processor "MyManufacturer-MyProcessor" Objects not added because they already exist: target.LanguageImplementation "ARM Compatible-ARM Cortex"
To remove the objects from the internal database, enter:
target.remove(objectsAdded);
"target.remove" summary: Objects removed from internal database: target.Processor "MyManufacturer-MyProcessor"
Create Timer Object
This example shows how you can create a timer object for your development computer.
Create the function signature for a timer. In this example, the function returns a uint64
data type and the function name timestamp_x86
.
timerSignature = target.create('Function'); timerSignature.Name = 'timestamp_x86'; timerSignature.ReturnType = 'uint64';
Capture the function in an API object.
timerApi = target.create('API'); timerApi.Functions = timerSignature; timerApi.Language = target.Language.C; timerApi.Name = 'Linux Timer API';
Capture the dependencies of the function, that is, the source and header files that are required to run the function.
timerDependencies = target.create('BuildDependencies'); timerDependencies.IncludeFiles = {'host_timer_x86.h'}; timerDependencies.IncludePaths = ... {'$(MATLAB_ROOT)/toolbox/coder/profile/src'}; timerDependencies.SourceFiles = {'host_timer_x86.c'};
Create an object that combines the API and dependencies.
timerImplementation = target.create('APIImplementation'); timerImplementation.API = timerApi; timerImplementation.BuildDependencies = timerDependencies; timerImplementation.Name = 'Linux Timer Implementation';
Create the timer object and associate it with the timer information.
timer = target.create('Timer'); timer.APIImplementation = timerImplementation; timer.Name = 'Linux Timer';
Note
Using name-value arguments, you can create the timer object with this command.
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'})
Assign the timer and add-ons to the processor object.
processor = target.get('Processor', 'Intel-x86-64 (Linux 64)'); processor.Timers = timer;
Create Description for Intel Core Processor
Create a description for the Intel Core® i7-8550U processor, which is a processor that supports hyperthreading.
i7 = target.create('Processor', ... 'Name', 'i7-8550U', ... 'Manufacturer', 'Intel', ... 'NumberOfCores', 4, ... 'NumberOfThreadsPerCore', 2); target.add(i7);
Version History
Introduced in R2019a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)