Kunom, that is a different beast.
The 'slope' you will be calculating isn't the slope that you would get from performing a slope analysis on a raster.
What you need to do is get the X, Y, and Z (ie elevations) at your points of interest.
You then convert the sequential X, Y values to a distance from the origin, which is P1 in your figure.
P2, etc are some distance from P1 etc etc.
The denser the point network along your line, the finer the gradient you can calculate.
Essentially if your points are sequential in a table, then the calculation can be made as a first pass by calculating the differential slope between points.
ie (Z2-Z1)/d1 where Z is elevation and 'd' is the distance.
so generically, (Zn - Zn-1)/dn
Those are your first order differences. Find the break where the values are out of range, if any.
Do you have the X, Y and Z values in tabular form... or a facsimile of your data that you could post?
I could demonstrate the sequential calculations.
And I presume by millions of points... you mean in one file? or many files? Doesn't really matter except for the number of times that the process needs to be done. (I don't need a million for now, just a reasonable sample)
A simple demo