I know I can follow Wolfram's guide and enable "ShowTiming" to show the timing of the previous command at the bottom of the window.

Red is "ShowTiming" and green is "AddTimeStamp"

Additionally, I can enable "AddTimeStamp" to show when each cell is evaluated next to the cell. I was wondering if I could sorta combine "ShowTiming" and "AddTimeStamp" and show how long each output takes NEXT to the output cell (replacing the timestamp). So instead of the output cells showing the timestamp, it would instead show the timing.

I know I could calculate this myself by subtracting the output date from the input date, but it would be more convenient to have this happen automatically.

  • 1
    $\begingroup$ What do you want to have happen when there is no output cell to attach the timing to? $\endgroup$
    – Carl Woll
    Jul 9, 2019 at 22:34
  • $\begingroup$ Would you give me an example? Like if I suppress the output with ;? $\endgroup$
    – Max Coplan
    Jul 10, 2019 at 15:47

1 Answer 1


Here's a Mathematica 12 stylesheet solution that adds the "ShowTiming" status area to each output cell label:

CurrentValue[EvaluationNotebook[], EvaluationCompletionAction] = {"ShowTiming"};

            CellEpilog :> With[{time = AbsoluteCurrentValue["WindowStatusArea"]},
                If[CurrentValue[NextCell[], CellStyle] === {"Output"},
                    SetOptions[NextCell[], CellLabel -> time<>" Out["<>ToString[$Line-1]<>"]="]
  • 2
    $\begingroup$ I was confused why it didn't work and now I know, one needs to have EvaluationCompletionAction set to "ShowTiming". p.s. even then it can't handle multi output cells from single input. (Don't want to be picky, just giving a feedback.) $\endgroup$
    – Kuba
    Jul 10, 2019 at 7:19
  • $\begingroup$ @Kuba Thanks for mentioning the EvaluationCompletionAction issue! Yes, multiple outputs are an issue. $\endgroup$
    – Carl Woll
    Jul 10, 2019 at 14:47
  • $\begingroup$ This isn't working for me. Which I think has something to do with this. I get a StringJoin::string error saying StringJoin: String expected at position 1 in Automatic <> Out[1]=. $\endgroup$
    – Max Coplan
    Jul 16, 2019 at 15:16
  • 2
    $\begingroup$ @MaxCoplan It seems that obtaining the value of the window status area is an M12 feature. $\endgroup$
    – Carl Woll
    Jul 16, 2019 at 15:34
  • $\begingroup$ Well, it seems I'll have to wait until that's resolved to get the benefits of it. I was able to confirm that your solution works though, using the window-resizing trick. So I can go ahead and mark that as right $\endgroup$
    – Max Coplan
    Jul 16, 2019 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.