How much time does the Arduino need to call a Function or to read a Variable?
It is hard to give a general answer, as it depends on the specifics of
your code and on how the compiler compiles it:


  How much time does an Arduino Uno or Mega need to only call a function.


This can involve a number of things:


the caller puts the arguments on some predefined CPU registers, unless
they are already there from a previous operation (the compiler tries
to optimize the code so that this happens whenever possible)
the caller issues the call instruction to do the actual function
call
the callee pushes some CPU registers into the stack in order to use
them without clobbering the caller's data
the callee does its job
the callee pops the previously pushed registers
the callee issues the ret (meaning return) instruction
the caller finds the return value in some CPU registers


On the Uno, the call and ret instructions cost 4&nbsp;CPU cycles
each (0.25&nbsp;µs). On the Mega, it's 5&nbsp;cycles (0.3125&nbsp;µs)
each. push and pop are 2&nbsp;cycles each, and you need one such
pair for every 8-bit register you need to save.


  And how does the time change if this function is inside a Class, for
  example inside a Library?


The only difference is that a class method receives an extra hidden
parameter called this. Except if it's a virtual method, which is more
expensive because it involves some pointer dereferencing.


  How much time does a micro-controller need to read a declared
  variable?


“Reading” generally means transferring the contents of the variable to
some CPU registers. Local variable are usually allocated to CPU
registers in the first place, so there is no need to read them. Global
(and local static) variables are stored in RAM, and reading them takes
2&nbsp;cycles per byte (e.g. 4 cycles for a 16-bit int).


  How to determine this values?


Disassemble the code generated by the compiler. Then look up the
instructions in the instruction set manual: it documents the number
of clock cycles needed by each instruction.