# Is there a package for monitoring Julia CPU mean usage?

**URL:** <https://discourse.julialang.org/t/is-there-a-package-for-monitoring-julia-cpu-mean-usage/117094>\
**Category:** New to Julia\
**Tags:** question, cplex, bash, cpu, exit\
**Created:** [July 16, 2024, 11:14am UTC](https://discourse.julialang.org/t/is-there-a-package-for-monitoring-julia-cpu-mean-usage/117094 "2024-07-16T11:14:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![K5Julien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/k5julien/32/210626_2.png) [@K5Julien](https://discourse.julialang.org/u/K5Julien)\
**Post date:** [July 16, 2024, 11:14am UTC](https://discourse.julialang.org/t/is-there-a-package-for-monitoring-julia-cpu-mean-usage/117094/1 "2024-07-16T11:14:47Z")

</div>

### Julia doesn’t seem to exist and thus doesn’t report CPU usage. I do not know if it is an issue related to the .sh script or to Julia

Pardon-me if it is not Julia related, and let me know, I’ll ask StackExchange instead.

I am using my Julia command within a bash [wrapper to monitor my mean CPU usage](https://superuser.com/a/1848641/942739).

```julia-auto
$ ./script_meanCPUMemory.sh bash -c "julia -t 1 src/script_etudedtsi.jl 80 20 100 366 2 10 5 1 0 0 1 1"

```

The content of `script_meanCPUMemory.sh` can be found in the StackExchange.SuperUser question. Please indicate whether you would like me to post it here in order to make this Julia Discourse question self-contained or not.

The code works like a charm, the following is an extract with some sensitive informations removed

```julia
$ ./script_meanCPUMemory.sh bash -c "julia -t 1 src/script_etudedtsi.jl 80 20 100 366 2 10 5 1 0 0 1 1"
  Activating project at `SomePath/`
[ Info: Loading Packages...
[ Info: DONE
[ Info: Including .jl files
[ Info: DONE
Some informations displayed [...]
  0.622681 seconds (2.04 M allocations: 36.255 MiB, 5.73% gc time, 42.59% compilation time)
  1.919937 seconds (317.64 k allocations: 454.407 MiB, 34.89% gc time, 17.93% compilation time)
Sum of prices 100%|██████████████████████████████████████████████████████████████████████| Time: 0:00:13
Some informations displayed [...]
 35.444421 seconds (87.81 M allocations: 2.222 GiB, 8.32% gc time, 64.69% compilation time: 10% of which was rec
ompilation)
Ended creating JuMP model 100%|████████████████████████████████████████████| Time: 0:00:17 (14.76 ms/it)
Some informations displayed [...]
Version identifier: 12.10.0.0 | 2019-11-26 | 843d4de
CPXPARAM_Threads 4
CPXPARAM_TimeLimit 120
Found incumbent of value 0.000000 after 0.01 sec. (6.13 ticks)

|CPLEX successfully running]

```

Then, a few seconds later:

```julia-auto

* 1144+ 1043 16005.6983 16021.7470 0.10%

GUB cover cuts applied: 163
Cover cuts applied: 491
Flow cuts applied: 12
Mixed integer rounding cuts applied: 521
Zero-half cuts applied: 55
Gomory fractional cuts applied: 14

Root node processing (before b&c):
  Real time = 34.57 sec. (10452.83 ticks)
Parallel b&c, 4 threads:
  Real time = 85.58 sec. (23100.72 ticks)
  Sync time (average) = 7.41 sec.
  Wait time (average) = 0.00 sec.
                          ------------
Total (root+branch&cut) = 120.15 sec. (33553.55 ticks)
termination_status(model) = MathOptInterface.TIME_LIMIT

|CPLEX successfully running]

Writing output...
CPLEX Error 1217: No solution exists. # This is normal, if you want to know why, see https://github.com/jump-dev/CPLEX.jl/issues/356
CPLEX Error 1217: No solution exists. # Please ignore, this is normal, if you want to know why, see https://github.com/jump-dev/CPLEX.jl/issues/356
^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[Bq^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B

```

You an see that it seems the .bash script doesn’t exit.

Please note that I tried to add `exit()` at the end of `script.etudedtsi.jl` with resulting the same failure:

```julia-auto
EtudeDTSI.launchoptimize(pars)
exit()

```

Only `Ctrl+C` will terminate the process without displaying the final `echo` of the bash script.

Do you know what happens?

Also maybe my problem could be simply solved if there was a package that aims to monitor mean CPU usage instead of using a .bash script. Have you heard of such a package?

Many thanks 😃

---

<div class="post-metadata">

**Author:** ![K5Julien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/k5julien/32/210626_2.png) [@K5Julien](https://discourse.julialang.org/u/K5Julien)\
**Post date:** [July 16, 2024, 2:37pm UTC](https://discourse.julialang.org/t/is-there-a-package-for-monitoring-julia-cpu-mean-usage/117094/2 "2024-07-16T14:37:54Z")

</div>

Please be aware that the bug has been resolved in SE.SuperUser, so it was not a Julia related question. However, this raises the question of whether there exists, and if not, if there is the need for a package that monitors CPU and Memory usage of a Julia command!

Wishing the best to Julia Discourse’s community 😃

---

<div class="post-metadata">

**Author:** ![AlexKlo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexklo/32/213268_2.png) [@AlexKlo](https://discourse.julialang.org/u/AlexKlo)\
**Post date:** [November 8, 2024, 10:57am UTC](https://discourse.julialang.org/t/is-there-a-package-for-monitoring-julia-cpu-mean-usage/117094/3 "2024-11-08T10:57:13Z")

</div>

Such a package would be very useful, something like [psutil](https://github.com/giampaolo/psutil/tree/master).
