Estimating P in Amdahl's Law theoretically and in practice
Amdahl divided a program in two parts, serial and parallel, and assumed each processor to have same compute ability. This concept has been further refined by Hill and Marty Amdahl's law in multi-core era, in other words it is not necessary that every processor should have same the compute ability and Cassidy Beyond Amdahl's Law: An Objective Function That Links Multiprocessor Performance Gains to Delay and Energy, in other words why divide in only two parts.

After a brief overview of Amdahl's law, I answer the question how to measure the serial (1-P) and parallel (P) parts of a program. 


Static instrumentation: Put a function that gives the current time like gettimeofday in Linux at the start of the program, the point where you create threads and points where you join threads and if necessary (if your program does a lot of post processing) at the end of program. Take differences and you will have the P value. Use the single threaded program. If you want to have more precision in measurement use the rdtscp instruction on Intel processors Excellent blog by Dr. John McCalpin. 
Dynamic instrumentation: It is possible to do the above even when you don't have the source code to do static instrumentation. You can use library preloading (LD_PRELOAD) or the Intel Pin tool Introduction to Pin using examples or similar dynamic binary instrumentation tools like Dynamorio, Valgrind and Linux perf Tutorial by Brendan gregg. All of them are established frameworks, completely free, with multiple research tools using them.