Is there a programming language for contests?
Is there a programming language that measures everything?
For instan开发者_Go百科ce, 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.
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).
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.
精彩评论