Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a programming language for contests?

Is there a programming language that measures everything?

For instance, I would like to measure how much memory was allocated, the number of operations used (in terms of cycles), and time spent on IO.

Such a language would be great for running a programming contest.

like image 252
MathGladiator Avatar asked Apr 11 '26 20:04

MathGladiator


2 Answers

It sounds like you want a tool, not necessarily a language. I use profiling tools to do these sorts of things with embedded C programs. Your compiler vendor may have similar tools available.

The OS is in charge of memory management, so it's probably easiest to get the OS to report that to you. Another option is to write a library that entrants are required to use that builds wrappers around malloc, etc. When the library's malloc is called, it logs how much memory was allocated and calls the real malloc. Once the program terminates, you have a complete log of the dynamic memory usage of the program. You can also write wrappers around I/O functions that log the latency of those functions (take a timestamp before calling the real function and after it completes).

like image 188
bta Avatar answered Apr 17 '26 12:04

bta


You might consider running a program compiled/interpreted by an existing language under a tool like ValGrind, which can report on these kinds of factors. You could extend ValGrind further if necessary.

like image 32
Tony Delroy Avatar answered Apr 17 '26 11:04

Tony Delroy