Centre d’aide MATLAB
Get task object from a worker running a task
t = getCurrentTask
t = getCurrentTask returns the parallel.Task object that the current worker is associated with. Use getCurrentTask to get information from the task during a computation, such as the running duration.
t
parallel.Task
getCurrentTask
If getCurrentTask is evaluated on a worker, t is a parallel.Task object. Otherwise, t is an empty double.
example
collapse all
Use getCurrentTask and RunningDuration property to find the running duration of the task that a worker is associated with.
RunningDuration
On a worker, use getCurrentTask to get the current task object t from a worker running the task t.
t = getCurrentTask;
Then, use the RunningDuration property to get the running duration of the task.
howLong = t.RunningDuration
[]
Task object, specified as a parallel.Task or empty double. When you use getCurrentTask on a worker, t is the parallel.Task object that the current worker is associated with. When you use getCurrentTask on the client, t is an empty double.
Data Types: parallel.Task
Introduced before R2006a
getAttachedFilesFolder | getCurrentCluster | getCurrentJob | getCurrentWorker
getAttachedFilesFolder
getCurrentCluster
getCurrentJob
getCurrentWorker
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
Europe
Asie-Pacifique
Contactez votre bureau local